c - 如何在 Linux 中找到不同的内存段起始位置及其大小

我是 Linux 新手。我想知道不同段(如堆栈、堆、数据等)的起始地址和大小及其当前使用情况。

我想知道如何在运行进程和核心转储中找到。

提前致谢。

最佳答案

首先查看 proc(5) 文件系统。 man 是你的 friend 。

/proc/[number]/maps 包含当前映射的内存区域及其访问权限的文件

在gdb中,你可以使用

$ gdb -q
(gdb) help info proc
Show /proc process information about any running process.
Specify any process id, or use the program being debugged by default.
Specify any of the following keywords for detailed info:
  mappings -- list of mapped memory regions.
  stat     -- list a bunch of random process info.
  status   -- list a different bunch of random process info.
  all      -- list all available /proc info.

查看 info proc mappings,除非它在没有/proc 时不起作用(例如在事后调试期间)。

https://stackoverflow.com/questions/6622237/

相关文章:

c# - BinaryWriter 问题 - "code adds some byte betwee

delphi - 什么是重置(句柄,1)?

asp.net - 在 asp 的 gridview 中使用 eval 获取 this 对象

java - 在这种情况下应该使用哪个集合?

image - 禁用从 Canvas 下载图像

mongodb - 我可以在 MongoDB 中存储关系数据库结构吗

dependency-injection - 为什么用这么多术语来表达同样的事情? IoC 和 DI

.net - Base64 编码替代下划线

sql - ManyToManyField 中 Django 中对象子集的不同值

android - 如何在小部件中使用 ListView ?