netcomander
Programmer
hi all,
I've got a problem with a programm, which deals with linked lists.
The main task of the programm is reading datas out of several database-tables.
Because I do not know how many fields will be found in a table, I store the datas in
a linked list with one element per field. After I'm done with the tables data I free the
allocated memory for the list in a loop like
while(listelement->next){
bffr = listelement;
listelement = listelement->next;
free((void *) bffr);
}...
then I go over to the next table, and I do again build my linked list.
Ok, now to the problem. The system (linux redhat 7.0) is not going to use the once
allocated memory twice. It seems to refuse to pick up the former allocated memory
location, which was given free by me by "free((void *) bffr);". Instead it is allocating
new memory, as if the freed memory was still occupied.
Yes, and this leads to the situation that my server takes up to 500MB Memory and
starts swapping.
I was glad by getting an advice that leads me to the light
greetings markus
I've got a problem with a programm, which deals with linked lists.
The main task of the programm is reading datas out of several database-tables.
Because I do not know how many fields will be found in a table, I store the datas in
a linked list with one element per field. After I'm done with the tables data I free the
allocated memory for the list in a loop like
while(listelement->next){
bffr = listelement;
listelement = listelement->next;
free((void *) bffr);
}...
then I go over to the next table, and I do again build my linked list.
Ok, now to the problem. The system (linux redhat 7.0) is not going to use the once
allocated memory twice. It seems to refuse to pick up the former allocated memory
location, which was given free by me by "free((void *) bffr);". Instead it is allocating
new memory, as if the freed memory was still occupied.
Yes, and this leads to the situation that my server takes up to 500MB Memory and
starts swapping.
I was glad by getting an advice that leads me to the light
greetings markus