www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/13/02:21:31

Date: Tue, 13 Aug 1996 09:16:16 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Cc: Francois Charton <deef AT pobox DOT oleane DOT com>, djgpp AT delorie DOT com
Subject: Re: Freeing and not freeing Windoze memory
In-Reply-To: <199608122323.JAA05799@gbrmpa.gov.au>
Message-Id: <Pine.SUN.3.91.960813085846.28748M-100000@is>
Mime-Version: 1.0

On Tue, 13 Aug 1996, Leath Muller wrote:

> > Also, if you do not need too much memory (several kbytes, 10s of kbytes, 
> > but not 100s of kbytes) you can consider using alloca(), which allocates 
> 
> Just a question on this: does DJGPP still allocate memory in powers of 2
> when allocating this way, or does it allocate the size of the structure?

No, `alloca' allocates in much smaller increments, like words or dwords.  
But I don't recommend using it for allocations larger than, say 5KB.  
That is because your function might be called in a deeply nested program, 
when some (most) of the stack is already used up.  Think about `alloca' 
as a way to declare a variable-size local array: usually, when the array 
size gets large, you'd prefer using `malloc' or declare it as a static.  
The same logic applies to `alloca' IMHO.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019