www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/02/26/23:50:44

Date: Sun, 26 Feb 1995 23:07:31 -0500 (EST)
From: Long Doan <ldoan1 AT osf1 DOT gmu DOT edu>
To: Kimberley Burchett <OKRA AT max DOT tiac DOT net>
Cc: DJGPP Mailing List <djgpp AT sun DOT soe DOT clarkson DOT edu>
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 |
+--------------------------------------------------------+


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019