Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
2
answers
2607
views
Obtaining starting adress of a page
I want to obtain the beginning of a memory page, a page that contains a function. In my case I try to achieve the page beginning of main function. Which lies in `0x400a80`, I think it is in code section of memory. I would appreciate if you can verify whether it is true or not. As far as I understood...
I want to obtain the beginning of a memory page, a page that contains a function.
In my case I try to achieve the page beginning of main function. Which lies in
0x400a80
, I think it is in code section of memory. I would appreciate if you can verify whether it is true or not.
As far as I understood, adress 0x400a80
lies in a page.
When I show memory segments of my process with pmap
, it shows a segment starting with 0x400000
with size 8K, and the next portion goes with 0x601000
with size 4K.
I want to obtain adress 0x400000
because it has the address of the main()
function. How can I achieve starting adress of a page when I have an adress that resides in that page? Is there any built-in way to do in linux ?
Utku
(1 rep)
May 5, 2020, 09:04 AM
• Last activity: Apr 10, 2025, 02:09 PM
1
votes
1
answers
701
views
What is the Higher Virtual Memory address (Kernel Mapping) of a process used to?
I have some questions on the Kernel mapping of a Linux process' higher virtual address: 1. Is that maps to the kernel text segment which is stored in the RAM(I read the ```vmlinuz``` will be extracted to the RAM)? 2. What is the use of it? 3. The `pmap` of a process shows it's mapping to the exe's s...
I have some questions on the Kernel mapping of a Linux process' higher virtual address:
1. Is that maps to the kernel text segment which is stored in the RAM(I read the
will be extracted to the RAM)?
2. What is the use of it?
3. The pmap
of a process shows it's mapping to the exe's segments, shared memory,stack,heap. Can I see the higher address kernel mapped also?
Franc
(309 rep)
May 7, 2020, 02:45 PM
• Last activity: Mar 25, 2025, 08:49 AM
0
votes
1
answers
129
views
pmap total always in kilobytes?
Does the Linux command "pmap" always give the total memory usage in kilobytes? ``` $ pmap 3208920 | tail -n 1 total 71836K ```
Does the Linux command "pmap" always give the total memory usage in kilobytes?
$ pmap 3208920 | tail -n 1
total 71836K
haba713
(307 rep)
Nov 15, 2023, 10:09 AM
• Last activity: Nov 15, 2023, 06:11 PM
3
votes
1
answers
619
views
Getting memory usage of a process: comparing pmap to top
I would like to get a process's memory usage and it seems that `pmap` can do that. However, the value it returns is different from what I see in `top` command. # pmap 22080 | grep total total 6588952K # top | grep 22080 22080 ghatee 20 0 6588948 5.873g 11936 R 100.0 9.4 1120:17 pw.x What is the reas...
I would like to get a process's memory usage and it seems that
pmap
can do that. However, the value it returns is different from what I see in top
command.
# pmap 22080 | grep total
total 6588952K
# top | grep 22080
22080 ghatee 20 0 6588948 5.873g 11936 R 100.0 9.4 1120:17 pw.x
What is the reason?
mahmood
(1271 rep)
Apr 23, 2019, 09:42 AM
• Last activity: Oct 15, 2022, 05:28 PM
2
votes
0
answers
609
views
How to inspect the memory map of the kernel given "root" privileges?
I use `pmap ` for inspecting the memory map of the user-space process ` `. How to inspect the memory map of the kernel given "root" privileges (i.e. all capabilities)? The reason I'm interested is that I'm developing kernel modules, and thus would like to know which memory segment/section a symbol r...
I use
pmap
for inspecting the memory map of the user-space process ``.
How to inspect the memory map of the kernel given "root" privileges (i.e. all capabilities)?
The reason I'm interested is that I'm developing kernel modules, and thus would like to know which memory segment/section a symbol resides in.
**Bonus**:
Also, in order to obtain this information "offline", I've tried as follows:
$ sudo readelf -a /boot/vmlinuz-5.8.0-50-generic
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
But apparently, the Linux image is not in ELF format (why?).
How can I see the segments/sections of the kernel image?
Shuzheng
(4931 rep)
May 8, 2021, 10:14 AM
1
votes
1
answers
473
views
Memory map to process for a large code segment
I know that ```pmap``` of a process shows how the memory mapping is done. For example, the first lines of pmap output shows the memory mapping to the text segment of the process' executable. Assume I have a really big executable and my code size is large. For a small text segment(small executable) t...
I know that
of a process shows how the memory mapping is done. For example, the first lines of pmap output shows the memory mapping to the text segment of the process' executable. Assume I have a really big executable and my code size is large. For a small text segment(small executable) the pmamp shows - 401000 - 4096 B - 4 KiB
of text segment mapped.
(1) If the text segment is really large how does it map?
(2) Is it map dynamically based on the pages required as part of the code execution progress?
Franc
(309 rep)
May 7, 2020, 08:24 AM
• Last activity: May 7, 2020, 09:18 AM
3
votes
0
answers
751
views
PS shows different RSS value from Pmap and Smem
I want to get the memory consumption by a process. I am using *RSS* parameter to determine it. I am getting same *RSS* value when I am using `pmap -xx ` and with `smem` tool. But when I am using `ps v ` to get the RSS then it is showing different value. I know for `pmap` and `smem` they use `/proc/p...
I want to get the memory consumption by a process. I am using *RSS* parameter to determine it.
I am getting same *RSS* value when I am using
pmap -xx
and with smem
tool.
But when I am using ps v
to get the RSS then it is showing different value.
I know for pmap
and smem
they use /proc/pid/smaps
file to get *RSS* value but I don't have idea about ps
tool.
What are the basis of this calculation in ps
tool and which is correct ps
or pmap
and smem
Mohit Ranawat
(31 rep)
Sep 13, 2019, 06:44 AM
• Last activity: Sep 13, 2019, 09:42 AM
Showing page 1 of 7 total questions