Mail Archives: djgpp/1996/08/13/02:21:31
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 -