www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/19/15:08:55

Message-Id: <m0w7Loe-000S2fC@natacha.inti.edu.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT edu DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT natacha DOT inti DOT edu DOT ar>
Organization: INTI
To: sacleary AT mtu DOT edu (Stephen A. Cleary), djgpp AT delorie DOT com
Date: Wed, 19 Mar 1997 17:08:12 +0000
MIME-Version: 1.0
Subject: Re: Beginner checking for memory leaks

sacleary AT mtu DOT edu (Stephen A. Cleary) wrote:
> I am a beginner in C, and I was writing some arbitrary data type
> collections (linked list, AVL tree, etc.), and I would like to check my
> code for memory leaks.  Is there any way you guys know of to do this? 
> (i.e. all of the free memory functions return the free system memory,
> which isn't changed by free())
> 
> Like is there some library function I'm not aware of that returns the free
> memory in the heap?

  You need the malloc sources (look the v2 directory of the distribution in 
Simtelnet, you'll find the whole libc sources). 
  In the malloc sources there are a function called _mstat (or something like 
that), but is conditionally compiled so you must define something like MSTAT 
(look the file is very clear).
  Put calls to this routine where you need to see how memory do you have.
  Then compile and link with it.
  The rotine dumps the values to stderr.
  If you have any trouble interpreting the values (or compiling) just ask me.

SET
--------------- 0 --------------------------------
Salvador Eduardo Tropea (SET).
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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