comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+news@pvv.org>
Subject: Re: Array and memory usage
Date: Sun, 9 Mar 2003 17:09:16 +0000 (UTC)
Date: 2003-03-09T17:09:16+00:00	[thread overview]
Message-ID: <slrnb6mt70.1lm.randhol+news@kiuk0152.chembio.ntnu.no> (raw)
In-Reply-To: EuKaa.21763$eG2.3707@sccrnsc03

Jeffrey Creem wrote:

> 
> I believe what you are seeing is not something that will happen under all
> OS's.
> 
> Linux uses a commit-on-us type memory manager. Even though you initialized
> your data, it probably was done in such a way that the memory was intialized
> within the ELF initialized data segment.
> 
> Under linux even something like
> 
> aa = malloc(A_BIG_NUMBER)
> 
> will not show all of the data as actually allocated until a process accesses
> each page of memory..
> 
> What you are seeing is partially a trick and partially real. It is not a
> direct effect of the language or compiler.
> 
> Whether or not you should write your programs to rely on it will depend on
> many factors.
> 
> Certainly on an embedded OS like vxWorks, your memory would be allocated and
> consumed immediately.

OK Thanks for clearing it up. I saw the effect last night so I decided
it was time for sleep as I thought I had done something else wrong. But
when I saw the same effect today I started wondering what the effect
was.

At any rate I think I'll stick with an array and set it to some number
that can be changed if needed. We are not talking about a lot of bytes
anyway :-)

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



  reply	other threads:[~2003-03-09 17:09 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
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 [this message]
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