Date: Sun, 26 Feb 1995 23:07:31 -0500 (EST) From: Long Doan To: Kimberley Burchett Cc: DJGPP Mailing List Subject: Re: topline On Sun, 26 Feb 1995, Kimberley Burchett wrote: > > 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 ^^^^^^^^^^^^^^^^^^ You were inside the CPU? Just kidding... > 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! The problem is, when you free something, the information is not updated by go32. I guess that you can always write my_malloc () and my_free () routines to keep track of memory usage, but I don't think that's necessary... Note: your "innocent" memory was not massacred, it is still there in the memory bank(s) somewhere... Just might not be linked, that's all... -:-< About the malloc calls changing the memory usage by about three times, I think that it's because malloc was going through its bits bucket, calling morecore, and caused the memory pages to be paged in. And only when these pages are paged in that the topline is updated. Anyway, it's probably NOT your fault that the topline's info behaves that way, and yes, you can just stand there and watch, or, better yet, rewrite malloc.c so that it updates go32's info. Hope that helps, Long. +--------------------------------------------------------+ | Long Doan ldoan1 AT osf1 DOT gmu DOT edu | | ld AT netrix DOT com | +--------------------------------------------------------+