gpt4 book ai didi

Linux:如何从正在运行的二进制文件中获取库列表及其内存详细信息?

转载 作者:太空宇宙 更新时间:2023-11-04 11:26:51 26 4
gpt4 key购买 nike

在 linux62 上运行二进制文件时,二进制文件占用了大量内存。这尤其发生在它加载 java.lang 之后。同样的事情在早期版本的 Linux 上运行良好,内存较少。

所以我想知道,是否有任何工具可以列出正在运行的二进制文件的已加载库及其内存大小。在当前正在运行的二进制文件上,我没有得到任何实用程序来执行此操作。ldd 和 objdump 仅从对象中获取详细信息,而不是从正在运行的进程中获取。

由于仅在我的程序启动并运行后才加载 java 库(加载 java 是可选的),因此我需要一个工具来从正在运行的二进制文件中列出一组库及其内存详细信息。这样我就可以了解哪个库占用更多内存,并且可以进一步调试。

谢谢唐加

最佳答案

# pidof init
1
# cat /proc/1/maps
00400000-004d2000 r-xp 00000000 fd:02 9790 /bin/systemd
006d2000-006df000 r--p 000d2000 fd:02 9790 /bin/systemd
006df000-006e0000 rw-p 000df000 fd:02 9790 /bin/systemd
006e0000-006e1000 rw-p 00000000 00:00 0
008df000-008e2000 rw-p 000df000 fd:02 9790 /bin/systemd
0203d000-036b1000 rw-p 00000000 00:00 0 [heap]
3c0c200000-3c0c222000 r-xp 00000000 fd:02 11536 /lib64/ld-2.14.90.so
3c0c421000-3c0c422000 r--p 00021000 fd:02 11536 /lib64/ld-2.14.90.so
3c0c422000-3c0c423000 rw-p 00022000 fd:02 11536 /lib64/ld-2.14.90.so
3c0c423000-3c0c424000 rw-p 00000000 00:00 0
3c0c600000-3c0c7ad000 r-xp 00000000 fd:02 12080 /lib64/libc-2.14.90.so
3c0c7ad000-3c0c9ad000 ---p 001ad000 fd:02 12080 /lib64/libc-2.14.90.so
3c0c9ad000-3c0c9b1000 r--p 001ad000 fd:02 12080 /lib64/libc-2.14.90.so
3c0c9b1000-3c0c9b3000 rw-p 001b1000 fd:02 12080 /lib64/libc-2.14.90.so
3c0c9b3000-3c0c9b8000 rw-p 00000000 00:00 0
3c0ce00000-3c0ce02000 r-xp 00000000 fd:02 10569 /lib64/libdl-2.14.90.so
3c0ce02000-3c0d002000 ---p 00002000 fd:02 10569 /lib64/libdl-2.14.90.so
3c0d002000-3c0d003000 r--p 00002000 fd:02 10569 /lib64/libdl-2.14.90.so
3c0d003000-3c0d004000 rw-p 00003000 fd:02 10569 /lib64/libdl-2.14.90.so
3c0d200000-3c0d217000 r-xp 00000000 fd:02 6336 /lib64/libpthread-2.14.90.so
3c0d217000-3c0d416000 ---p 00017000 fd:02 6336 /lib64/libpthread-2.14.90.so
3c0d416000-3c0d417000 r--p 00016000 fd:02 6336 /lib64/libpthread-2.14.90.so
3c0d417000-3c0d418000 rw-p 00017000 fd:02 6336 /lib64/libpthread-2.14.90.so
3c0d418000-3c0d41c000 rw-p 00000000 00:00 0
3c0da00000-3c0da07000 r-xp 00000000 fd:02 22071 /lib64/librt-2.14.90.so
3c0da07000-3c0dc06000 ---p 00007000 fd:02 22071 /lib64/librt-2.14.90.so
3c0dc06000-3c0dc07000 r--p 00006000 fd:02 22071 /lib64/librt-2.14.90.so
3c0dc07000-3c0dc08000 rw-p 00007000 fd:02 22071 /lib64/librt-2.14.90.so
3c0de00000-3c0de15000 r-xp 00000000 fd:02 16692 /lib64/libgcc_s-4.6.3-20120306.so.1
3c0de15000-3c0e014000 ---p 00015000 fd:02 16692 /lib64/libgcc_s-4.6.3-20120306.so.1
3c0e014000-3c0e015000 rw-p 00014000 fd:02 16692 /lib64/libgcc_s-4.6.3-20120306.so.1
3c0e200000-3c0e21d000 r-xp 00000000 fd:02 28104 /lib64/libselinux.so.1
3c0e21d000-3c0e41d000 ---p 0001d000 fd:02 28104 /lib64/libselinux.so.1
3c0e41d000-3c0e41e000 r--p 0001d000 fd:02 28104 /lib64/libselinux.so.1
3c0e41e000-3c0e41f000 rw-p 0001e000 fd:02 28104 /lib64/libselinux.so.1
3c0e41f000-3c0e420000 rw-p 00000000 00:00 0
3c0ee00000-3c0ee04000 r-xp 00000000 fd:02 63328 /lib64/libcap.so.2.22
3c0ee04000-3c0f003000 ---p 00004000 fd:02 63328 /lib64/libcap.so.2.22
3c0f003000-3c0f004000 rw-p 00003000 fd:02 63328 /lib64/libcap.so.2.22
3c12600000-3c12643000 r-xp 00000000 fd:02 52994 /lib64/libdbus-1.so.3.5.6
3c12643000-3c12842000 ---p 00043000 fd:02 52994 /lib64/libdbus-1.so.3.5.6
3c12842000-3c12843000 r--p 00042000 fd:02 52994 /lib64/libdbus-1.so.3.5.6
3c12843000-3c12844000 rw-p 00043000 fd:02 52994 /lib64/libdbus-1.so.3.5.6
3c1be00000-3c1be17000 r-xp 00000000 fd:02 57102 /lib64/libaudit.so.1.0.0
3c1be17000-3c1c017000 ---p 00017000 fd:02 57102 /lib64/libaudit.so.1.0.0
3c1c017000-3c1c018000 r--p 00017000 fd:02 57102 /lib64/libaudit.so.1.0.0
3c1c018000-3c1c019000 rw-p 00018000 fd:02 57102 /lib64/libaudit.so.1.0.0
3c1c019000-3c1c01d000 rw-p 00000000 00:00 0
3c1c600000-3c1c604000 r-xp 00000000 fd:02 13766 /lib64/libattr.so.1.1.0
3c1c604000-3c1c803000 ---p 00004000 fd:02 13766 /lib64/libattr.so.1.1.0
3c1c803000-3c1c804000 rw-p 00003000 fd:02 13766 /lib64/libattr.so.1.1.0
3c1d200000-3c1d20d000 r-xp 00000000 fd:02 76182 /lib64/libpam.so.0.83.1
3c1d20d000-3c1d40c000 ---p 0000d000 fd:02 76182 /lib64/libpam.so.0.83.1
3c1d40c000-3c1d40d000 r--p 0000c000 fd:02 76182 /lib64/libpam.so.0.83.1
3c1d40d000-3c1d40e000 rw-p 0000d000 fd:02 76182 /lib64/libpam.so.0.83.1
3c1d600000-3c1d617000 r-xp 00000000 fd:02 18152 /lib64/libnsl-2.14.90.so
3c1d617000-3c1d816000 ---p 00017000 fd:02 18152 /lib64/libnsl-2.14.90.so
3c1d816000-3c1d817000 r--p 00016000 fd:02 18152 /lib64/libnsl-2.14.90.so
3c1d817000-3c1d818000 rw-p 00017000 fd:02 18152 /lib64/libnsl-2.14.90.so
3c1d818000-3c1d81a000 rw-p 00000000 00:00 0
3c1ea00000-3c1ea0e000 r-xp 00000000 fd:02 14124 /lib64/libudev.so.0.12.0
3c1ea0e000-3c1ec0e000 ---p 0000e000 fd:02 14124 /lib64/libudev.so.0.12.0
3c1ec0e000-3c1ec0f000 r--p 0000e000 fd:02 14124 /lib64/libudev.so.0.12.0
3c1ec0f000-3c1ec10000 rw-p 0000f000 fd:02 14124 /lib64/libudev.so.0.12.0
3c27000000-3c27008000 r-xp 00000000 fd:02 76173 /lib64/libwrap.so.0.7.6
3c27008000-3c27208000 ---p 00008000 fd:02 76173 /lib64/libwrap.so.0.7.6
3c27208000-3c27209000 rw-p 00008000 fd:02 76173 /lib64/libwrap.so.0.7.6
3c27209000-3c2720a000 rw-p 00000000 00:00 0
7febd3c96000-7febd3ca2000 r-xp 00000000 fd:02 45355 /lib64/libnss_files-2.14.90.so
7febd3ca2000-7febd3ea1000 ---p 0000c000 fd:02 45355 /lib64/libnss_files-2.14.90.so
7febd3ea1000-7febd3ea2000 r--p 0000b000 fd:02 45355 /lib64/libnss_files-2.14.90.so
7febd3ea2000-7febd3ea3000 rw-p 0000c000 fd:02 45355 /lib64/libnss_files-2.14.90.so
7febd3ea3000-7febd403c000 rw-p 00000000 00:00 0
7febd40ca000-7febd40d2000 rw-p 00000000 00:00 0
7febd40f9000-7febd40fc000 rw-p 00000000 00:00 0
7fffce1cd000-7fffce1ee000 rw-p 00000000 00:00 0 [stack]
7fffce1ff000-7fffce200000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

关于Linux:如何从正在运行的二进制文件中获取库列表及其内存详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14193288/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com