delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/09/22/05:15:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Artur Pendzich" <apendzich AT wytnijplusnet DOT pl>
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: <opsep0qci3zsx1fw@froggy>
NNTP-Posting-Host: 80.51.254.226
Mime-Version: 1.0
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

- Raw text -


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