From: Preben Randhol <randhol+news@pvv.org>
Subject: Re: Array and memory usage
Date: Sun, 9 Mar 2003 12:11:06 +0000 (UTC)
Date: 2003-03-09T12:11:06+00:00 [thread overview]
Message-ID: <slrnb6mbnv.8a1.randhol+news@kiuk0152.chembio.ntnu.no> (raw)
In-Reply-To: 2397C8D4BA396B7A.ADB0E590CE8E5EAE.1C7AEC9AFCA7BE12@lp.airnews.net
John R. Strohm wrote:
> "Preben Randhol" <randhol+news@pvv.org> wrote in message
> news:slrnb6m8mg.15o.randhol+news@kiuk0152.chembio.ntnu.no...
>> 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;
>
> This declares two types and NO instances of those types.
>
>> 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.
>
> This declares the same two types and TWO (2) implicit instances of
> Str_Array_Type, namely, the aggregate constants. That's where the
> difference comes from.
>
Ok but I also have a :
User_Db : User_Data;
And if I use the first User_Data type then the memory usage only increases as
I add Names and Hostnames. I mean it doesn't go from 800 to 2356 as I
add one name, but slowly until all Names are added. This puzzeles me.
--
() Join the worldwide campaign to protect fundamental human rights.
'||}
{||' http://www.amnesty.org/
next prev parent reply other threads:[~2003-03-09 12:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-09 11:19 Array and memory usage Preben Randhol
2003-03-09 11:52 ` John R. Strohm
2003-03-09 12:11 ` Preben Randhol [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2003-03-12 22:04 Alexandre E. Kopilovitch
2003-03-12 22:20 ` Larry Kilgallen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox