www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/26/12:13:11

Subject: Unable to free memory..
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Wed, 26 Apr 1995 15:03:58 +0100 (BST)
From: "B.S.Runnacles" <B DOT S DOT Runnacles AT soton DOT ac DOT uk>

Dear all....

I have this bit of (schematic) code that frees the memory used in a linked 
list:

LinkedList::~LinkedList(void)
{
listnode *Root,*Current; // a data structure with next pointer and data
_go32_dpmi_meminfo info1,info2;
for (Current = Root; Current != NULL; Current = Current->next) {
	_go32_dpmi_get_free_memory_information(&info1);
	delete Current;
	_go32_dpmi_get_free_memory_information(&info2);
	cout << info2.available_memory - info1.available_memory << endl;
	}
}

But the result says that there is no difference in the free memory before and 
after the delete call.  Has anyone got any ideas as to why?  I may be doing
something fundementally wrong here, any hints would be nice.  I think the
memory isn't being freed because after a few hundred iterations the code
falls over complaining of a full swap file.

Ben Runnacles
Image, Speech and Intelligent Systems Group
University of Southampton, UK.



- Raw text -


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