Hello,
I am writing an IRC-like chat server but have come up onto a problem. I have a class called cChannelHandler that handles all the channel issues. I ran a test script that created 20000 Channels which are structures calles sChannels. These structures are linked lists. Creating them goes fine. according to /proc/pid/status the memory usage does rise. But when I delete the lists the memory usage is still increasing according to proc. I'm wondering if this is just a bug in linux or something I am doing wrong.
Below is a snippet of the RemoveChannel Function
Code:
sChannels *tempchan;
sChannels *tempchan2;
tempchan = GetChannel(*channum); //Returns A Channel Pointer
if(*channum == 0)
{
tempchan = ChannelList->next;
ChannelList->next=NULL;
delete ChannelList;
ChannelList = tempchan;
numchannels--;
}
else
{
tempchan2 = tempchan->next;
tempchan->next = NULL;
delete tempchan;
GetChannel((*channum) - 1)->next = tempchan2;
numchannels--;
}
Please help me out here. what is causing this program to increase memory usage when I delete.