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 :
What is the Heap Size that is allocated/set aside for this kernet config.
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.
精彩评论