X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Artur Pendzich" Newsgroups: comp.os.msdos.djgpp Subject: unload_datafile() Date: Wed, 22 Sep 2004 11:02:26 +0200 Organization: tp.internet - http://www.tpi.pl/ Lines: 55 Message-ID: NNTP-Posting-Host: 80.51.254.226 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: atlantis.news.tpi.pl 1095844013 3154 80.51.254.226 (22 Sep 2004 09:06:53 GMT) X-Complaints-To: usenet AT tpi DOT pl NNTP-Posting-Date: Wed, 22 Sep 2004 09:06:53 +0000 (UTC) User-Agent: Opera M2/7.54 (Win32, build 3865) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com HI! I have problem with freeing memory in my program. This is a piece of my programm. void unload_all(void) { unload_datafile(datafile) if (game1) { free(cards); free(table); unload_datafile(wondata); destroy_bitmap(bmp1); destroy_bitmap(bmp2); } else { unload_datafile(supdata); destroy_bitmap(belt1); destroy_bitmap(belt2); } destroy_bitmap(bmp_auto); } (...) int client_reaction(void) { ... switch(a) { ... case KEY_Z: { physmem1 = _go32_dpmi_remaining_physical_memory(); virtmem1 = _go32_dpmi_remaining_virtual_memory(); unload_all(); physmem2 = _go32_dpmi_remaining_physical_memory(); virtmem2 = _go32_dpmi_remaining_virtual_memory(); } ... } After calling function unload_all() variables physmemx and virtmemx shows that there is the same amount of reamining memory. Why? I load several datafiles, create some bitmaps and then unload them from memory using unload_all. After it I load next set of datafiles and bitmaps and once again unload them. After several loops I have not enought memory to load datafile and in finction load_datafile() program freezes. Where is the problem? What am I doing wrong? PLaease, help me. Artur Pendzich