Mail Archives: djgpp/1997/11/02/23:38:11
At 10:19 11/1/1997 +0500, Guillermo Porras wrote:
>
>I malloc memory for lists i handle.
>The lists change very often and i malloc new mem for the new lists
>and free() the old lists mem.
>
>But soon i got out of mem ,
>I think there is some part of my prog, in which
> i´m not free()ing something I´m malloc()king to many times.
>So i just had the Idea to monitor my total free mem
>and /or used mem.
>Is there a function to see how much mem i got free or used ?
>
>I´m sure I might need less than 3 Mb Ram for what i´m doing.
>So I´m not thinking in Virtual as an option.
There is a tool somewhere for debugging memory leaks, arena corruption, and
other malloc problems. I think it might be called `Sentinel', or `MSS', or
something. Unfortunately, I have no idea where you might find it. Can
somebody follow-up with a pointer?
You could do something very simple, like writing a wrapper around `malloc'
which adds to a total each time you call it.
Also, be aware that DJGPP's usual `malloc' rounds each allocation up to the
nearest power of 2. If you allocate a large number of relatively small
blocks, the overhead could be significant. You might want to think about that.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -