Message-Id: <199902172204.RAA21716@delorie.com> From: "Stefan Viljoen" To: Subject: Memory leaks, and allegro Date: Wed, 17 Feb 1999 23:56:51 -0800 X-MSMail-Priority: Normal X-Priority: 3 X-Mailer: Microsoft Internet Mail 4.70.1155 Reply-To: djgpp AT delorie DOT com Hi! 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. I. e. the code looks something like this: phys_before = (unsigned int)_go32_dpmi_remaining_physical_memory(); do_dialog(test_dialog,-1); phys_after = (unsigned int)_go32_dpmi_remaining_physical_memory(); Subtracting phys_after from phys_before consistently reports 4096 bytes discrepancy - why? Is this 'cause the do_dialog() code uses static variables somewhere? Does this apparent memory leak increase if you call the function again? I ask this cause I encountered an extremely severe memory leak in a function that makes quite extensive use of the Allegro dialog procedures. After 2 or 3 entries into the function that calls the Allegro dialog stuff, my system starts slowing down with lots of disk access that keeps on getting more severe - I also build up a linked list in one of these functions that is deallocted again on exit (I think!). My question is, where is the most likely cause of the memory leak? In the code that deallocates the list (it is all I can think off) or because of this apparent 4k leak in do_dialog? Or is it a feature of do_dialog? ;) How can I test for memory leaks in DJGPP programs? Will remaining_physical and remaining_virtual work for this? Or must I go "back to the drawing board" on any linked list code that might be in the gui functions called by the dialog function? 'cause I tested the linked list code outside of being used in a do_dialog procedure and it worked just fine (no apparent leaks)? Fanx! Please reply by mail if at all possible. -- Spawned By Rylan Rylan AT intekom DOT co DOT za http://home.intekom.com/rylan/ Power Overwhelming