Mail Archives: djgpp/1998/06/24/08:57:05
> How does free() know how much memory to return to the heap? Does it have
> to be the originally malloc()ed pointer or can it be a different pointer
> to the memory that was allocated? I'm writing a linked list and keeping
> pointers to each element around kinda defeats the purpose... thanks in
> advance for any help
Well yeah, when you malloc a block, it keeps the pointer, then when you free
it it checks the pointer and returns it to the heap
Well allocate one big block (for the whole list) and use the block
dynamically.
tom
- Raw text -