i'm writing a program that uses a linked list (actually it uses lots of
linked lists, all linked together...) and it's all working nicely, i use
malloc() to allocate the ram when needed and would like to know if malloc()
uses Linux swap when it runs out of 'real' ram (i think it does because once
the program got stuck in an endless loop and the harddrive went mad, then my
out of memory check kicked in and quit the program).

Also, if i have a list defined as following:

typedef struct node node_t;
struct node {
        data *stuff;
        node_t *next;
}

and i make a list with it, how do i free all the ram that the list uses? this
is the part of lists i could never work out.

node_t *mylist, *temp;

build_a_list (mylist);
while (mylist) {
        temp = mylist;
        free (mylist);
        mylist = temp->next;
}
mylist = NULL;


-- 
>> I Like England Just Fine, But I Ain't Eating Any Of That Beef <<
<<  MailTo: root <at> kermit "dot" globalnet /dot\ co 'dot' uk   >>
>>                     De Chelonian Mobile                       <<

Reply via email to