开发者

Bounds of heap-allocated memory using malloc.c

I am doing some hacking with Doug Lea's malloc.c (under Linux x86_64), and I need to find the lowest allocated address and the address of the high end of the highest allocated chunk--in other words, the bounds of allocated memory--which of course excludes the mspace's struct malloc_state bookkeeping structure. How can I get these addresses? Note that I am not looking for the bounds of the entire heap, but only those of the allocated portion, which will usually include unallocated "holes" between the lowest and highest allocated chunks. I have been using the least_addr and to开发者_运维百科p fields of the malloc_state structure. Is this correct? Thank you!


From what I understand, this should work. Malloc uses these values to define where it can allocate memory.

Here is a malloc implementation, it may help answer your questions.

http://asf.atmel.no/avr32/services/storage/mem_manager/dlmalloc/examples/example1/at32uc3a0512_evk1105/doc/html/a00036_source.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜