Mail Archives: djgpp/1995/02/26/23:48:25
> Is it me or is topline not updated when I free something?
> I was concerned that my program seemed to be taking 3 times as much
>memory as it should, so I traced through it to make sure it was calling
>free. It was, but topline didn't change.
> This is how my program seems to go:
>
> malloc 230k - topline goes up 475k
> free 50k - topline stays where it is
> malloc 77k - topline goes up 120k
> free 77k - topline stays where it is
>
> Obviously at least some of this is still my fault. But I was _there_
>when it free'ed memory - I _saw_ it happen... and topline didn't do
>anything at all. It just sat there, letting all this innocent memory get
>massacred. How can I stand by and watch this atrocity? Please, someone,
>help me end this!
`free'd memory, I believe, is generally not returned directly to the
system, but rather marked to your program as free and used by malloc
preferentially over `new' memory, so you shouldn't expect topline to
change after calls to free; however, if you malloc something, free it,
and then malloc something of the same size or smaller, your program's
memory footprint should not change after the initial malloc.
--- Aaron Ucko (ucko AT vax1 DOT rockhurst DOT edu; finger for PGP public key) -=- httyp!
-=*=-Just because you're paranoid doesn't mean they aren't out to get you.-=*=-
Geek code 2.1 [finger hayden AT vax1 DOT mankato DOT msus DOT edu for explanation]:
GCS/M/S d(-) H s g+ p? !au a-- w+ v+ C++(+++)>++++ UL++(-)(S+)>++++ P++
L+(++) 3(-) E-(----) !N>++ K- W-(---) M-(--) V(--) po-(--) Y+(++) t(+) !5 j R
G tv--(-) b+++ !D(--) B--(---) e>++++(*) u++(@) h!() f(+) r-(--)>+++ n+(-) y?
- Raw text -