Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE3567337@probe-2.acclaim-euro.net> From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: Memory leaks, and allegro Date: Fri, 19 Feb 1999 15:42:39 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1460.8) Content-Type: text/plain Reply-To: djgpp AT delorie DOT com Stefan Viljoen writes: > I have encountered something strange while working with Allegro 3.1 - > the function _go32_dpmi_remaining_physical_memory > always reports 4k (4096 bytes) less memory as "remaining" if you call it > before and after any Allegro GUI dialog procedure that handles a DIALOG > object. As Eli says, you cannot use the DPMI functions to track memory usage, so these results are meaningless. You need to use a debugging malloc package instead. It is interesting, though, that a lot of people seem to keep bringing up the Allegro GUI functions in relation to this issue. I'm not sure why that is: I'm about 99.999% positive that there is no memory leak anywhere in that code (there is only one allocation, and that absolutely does get freed in the right place). It seems very odd, though, that whenever someone mistakenly tries to use DPMI functions to check for memory leaks, the GUI routines are where they first notice things going wrong... Eli Zaretskii replied: > You didn't tell which version of DJGPP did you use. If that was 2.01, > I suggest to upgrade to v2.02, where the memory allocation functions > has been rewritten to use memory more efficiently. The 2.02 malloc is also a lot less forgiving of errors like freeing the same pointer twice, or writing past the end of a block (it was far too easy to get away with that in 2.01, since the size would be rounded up and you would end up with a large safety buffer). I found a couple of allocation errors because things started crashing as soon as I upgraded to 2.02, which was certainly very useful... Shawn Hargreaves.