开发者

How to find size of heap present in Linux?

I have a Linux running on a ARM Cortex-A8 processor board. The version of the kernel is obtained by (uname -a):

Linux 2.6.29-dirty #2 Fri Jan 29 16:54:21 IST 2010 armv7l unknown

To debug some of my application which crashes due to malloc() failure(The size i am mallocing is large), and the board has 208 MB DRAM. On this Linux/board setup, i need to find out :

  1. What is the Heap Size that is allocated/set aside for this kernet config.

  2. How can i increase this heap size. Does it need kernel re-build/new versio开发者_开发问答n of kernel image?


I don't know about specifics of the ARM Linux; however, assuming that you are talking about userspace application and not kernel space, there is inherently no 'heap size'. The 'classical unix way' of userspace memory management is an 'expanding heap' - the application has a heap of finite size and when it needs to expand it, it calls the brk() function. I guess you have no swap and disabled overcommit on this platform - looki into /proc/meminfo (or output of 'top') to see the available memory.


If it's like on x86 - Heap and stack are in the same data segment (most likely yes) and heap is growing upwards - stack is growing downwards - you can check the difference between top of heap and top of stack - that should give you theoretical maximum to allocate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜