Mail Archives: djgpp/1995/08/29/10:17:32
On Mon, 28 Aug 1995, DJ Delorie wrote:
>
> > this really looks like a big bug somewhere: compile the following code and
> > you'll se how v2 eats memory. Nope, it is not a malloc trouble: you can
> > obtain the same using new/delete.
>
> Not a bug, just a poor interaction between malloc and your program.
> You're (intentionally or otherwise) forcing malloc to ask for more
> system memory each time, because each size is in a different hash
> bucket (or something like that).
>
Hey but this program eats 18mb of memory in 10 or so iterations!!!!
It is not just question of leaving a bucket (also because I free each block
before asking for a new one).
Since I'm on a sun now I can't verify but I'll check to see if the trouble
is still up with fixed memory sizes. I think so because I have the same
problem with a real application (my picture viewer) that (of course)
allocate and free big chuncks of memory...
Ciao,
Davide.
- Raw text -