如何查找Linux中存在的堆大小? [英] How to find size of heap present in Linux?
问题描述
我有一个在ARM Cortex-A8处理器板上运行的Linux.内核的版本是通过(uname -a)获得的:
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不详
Linux 2.6.29-dirty #2 Fri Jan 29 16:54:21 IST 2010 armv7l unknown
要调试我的一些应用程序,该应用程序由于malloc()失败而崩溃(我正在分配的大小很大),并且板上有208 MB DRAM.在此Linux/board设置中,我需要找出:
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 :
-
为此kernet配置分配/保留的堆大小是什么.
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 version of kernel image?
推荐答案
我不了解ARM Linux的详细信息.但是,假设您是在谈论用户空间应用程序而不是内核空间,那么天生就没有堆大小".用户空间内存管理的经典unix方式"是扩展堆"-应用程序具有有限大小的堆,当需要对其进行扩展时,它将调用brk()函数. 我猜您在该平台上没有任何交换和禁用过量使用权限-可以查看/proc/meminfo(或"top"的输出)以查看可用内存.
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.
这篇关于如何查找Linux中存在的堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!