X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Artur Pendzich" Newsgroups: comp.os.msdos.djgpp Subject: Re: unload_datafile() Date: Wed, 22 Sep 2004 13:28:10 +0200 Organization: tp.internet - http://www.tpi.pl/ Lines: 70 Message-ID: References: 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: nemesis.news.tpi.pl 1095852933 25416 80.51.254.226 (22 Sep 2004 11:35:33 GMT) X-Complaints-To: usenet AT tpi DOT pl NNTP-Posting-Date: Wed, 22 Sep 2004 11:35:33 +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 Dnia Wed, 22 Sep 2004 11:02:26 +0200, Artur Pendzich napisał: > 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? ok, I have red djgpp faq (15.2) and I know why _go32_dpmi_remain... indicates the same values, but.. > 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. system doesn't see freed memory but cwsdpmi should see it. So why program hangs after several load-unload sequences in load_datafile function? One more problem: even after reeboot go32_v2 answers : descriptors exhausted. Do someone knows why? Thanks Artur Pendzich