comp.lang.ada
 help / color / mirror / Atom feed
* Re: Array and memory usage
@ 2003-03-12 22:04 Alexandre E. Kopilovitch
  2003-03-12 22:20 ` Larry Kilgallen
  0 siblings, 1 reply; 21+ messages in thread
From: Alexandre E. Kopilovitch @ 2003-03-12 22:04 UTC (permalink / raw)
  To: comp.lang.ada

>>Am I confused, or was the designer of Windwos confused?
>
>You want me to explain why Windows is designed the way it is?

It seems that convoluted virtual memory policies appeared in VAX VMS,
and Windows NT inherited (not surprisingly) from there.




^ permalink raw reply	[flat|nested] 21+ messages in thread
* Array and memory usage
@ 2003-03-09 11:19 Preben Randhol
  2003-03-09 11:52 ` John R. Strohm
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Preben Randhol @ 2003-03-09 11:19 UTC (permalink / raw)


I was a bit puzzeled to see that if I do:

   type Str_Array_Type is array (1 .. 1000) of String (1 .. 800);

   type User_Data is
      record
         Name     : Str_Array_Type;
         Hostname : Str_Array_Type;
      end record;

my program uses 800 bytes of memory, while if I only change the program
like this:

   type User_Data is
      record
         Name     : Str_Array_Type := (others => (others => ' '));
         Hostname : Str_Array_Type := (others => (others => ' '));
      end record;

then the program uses 2356 bytes.

I thought all the memory needed for an array would be claimed when the
program started no matter if the array was filled or not.

Is this correct or am I just being tricked by the program that measures
the memory used by my program? 

If it is correct then it doesn't matter if I define my array as (1 ..
100) or (1 .. 10_000) as long as I don't initialize the strings.
I can just add to User_Data a:

   type Used_Type is array (1 .. 1000) of Boolean;

   Used : Used_Type := (others => False);

And then I don't need to add any linked list etc... to my small server.

I use GNAT 3.14p on i386 Linux (Debian).

Thanks in advance

Prebene Randhol
-- 
 ()   Join the worldwide campaign to protect fundamental human rights.
'||}
{||'                                           http://www.amnesty.org/



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2003-03-12 22:20 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-12 22:04 Array and memory usage Alexandre E. Kopilovitch
2003-03-12 22:20 ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09 11:19 Preben Randhol
2003-03-09 11:52 ` John R. Strohm
2003-03-09 12:11   ` Preben Randhol
2003-03-09 13:34     ` Marin David Condic
2003-03-09 15:05       ` Preben Randhol
2003-03-10  1:45       ` Mark Biggar
2003-03-10 11:57         ` Marin David Condic
2003-03-10 12:06           ` Jeffrey Creem
2003-03-09 17:49     ` Robert A Duff
2003-03-09 17:04 ` Jeffrey Creem
2003-03-09 17:09   ` Preben Randhol
2003-03-09 18:10 ` Robert A Duff
2003-03-10 15:13   ` Matthew Heaney
2003-03-10 23:33     ` Robert A Duff
2003-03-11  0:40       ` Randy Brukardt
2003-03-11 23:37         ` Robert A Duff
2003-03-12 19:18           ` Randy Brukardt
2003-03-11 16:01       ` Matthew Heaney
2003-03-11 17:38       ` Warren W. Gay VE3WWG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox