Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

brk

Name: Anonymous 2009-03-22 2:53

I just finished debugging a re-invention of malloc and free - obviously, because I'm changing the value of brk myself, I'm not using mmap or the stdlib malloc or anything silly like that. When I test the program with MY functions, the value of brk after free is the same as it was before malloc. However, using the stdlib malloc, the value of brk is 0x21000 larger after free than it was before malloc, even though I'm only allocating around 25kb in memory.

Can someone explain to me why the fuck that would make sense?

Name: Anonymous 2009-03-22 5:34

>>3
Yeah of course I was using sbrk() more often.

I'm not saying there's a particular reason it shouldn't, I'm saying that I don't understand what is saved in that memory and why it needs to be saved if you don't have any data allocated to the heap. Is it just a record of data that used to be there? I don't see the use in that, it seems like a waste of memory. Seems to me it would only serve to help the program run out of memory more quickly.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List