From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d02eb5c33ac65d9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-09 04:11:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!uninett.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: Array and memory usage Date: Sun, 9 Mar 2003 12:11:06 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: <2397C8D4BA396B7A.ADB0E590CE8E5EAE.1C7AEC9AFCA7BE12@lp.airnews.net> NNTP-Posting-Host: kiuk0152.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1047211866 16111 129.241.83.78 (9 Mar 2003 12:11:06 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Sun, 9 Mar 2003 12:11:06 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:35087 Date: 2003-03-09T12:11:06+00:00 List-Id: John R. Strohm wrote: > "Preben Randhol" 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/