Mail Archives: djgpp/1995/04/26/12:13:11
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 -