如何找到最大堆栈大小? [英] How do I find the maximum stack size?

查看:154
本文介绍了如何找到最大堆栈大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 11.04.如何找出进程的最大调用堆栈大小以及堆栈中每一帧的大小?

I am working on Ubuntu 11.04. How do I find out the maximum call stack size of a process and also the size of each frame of the stack?

推荐答案

您可以使用getrlimit查询最大进程和堆栈大小.堆栈框架没有固定的尺寸.这取决于每帧需要多少本地数据(即本地变量).

You can query the maximum process and stack sizes using getrlimit. Stack frames don't have a fixed size; it depends on how much local data (i.e., local variables) each frame needs.

要在命令行上执行此操作,可以使用ulimit.

To do this on the command-line, you can use ulimit.

如果要读取正在运行的进程的这些值,我不知道执行此操作的任何工具,但是查询/proc文件系统很容易:

If you want to read these values for a running process, I don't know of any tool that does this, but it's easy enough to query the /proc filesystem:

cat /proc/<pid>/limits

这篇关于如何找到最大堆栈大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆