Re: Help understanding memory layout
From: linux-os
Date: Thu Oct 28 2004 - 12:53:52 EST
On Thu, 28 Oct 2004, Phy Prabab wrote:
Hello,
I need some help understanding memory layout of
applications within memory under linux. I am using
the command "pmap" to understand where all the
elements of my application are laying and found that I
just do not understand how and why it is layed out in
a particular fashion. Is there documentation that
could help me understand memory management under
Linux?
Thank you for your time.
Phy
You can look in /proc/PID/maps to see where memory-mapped
stuff exists. PID is the process-ID number.
You can also use printf("%p\n", function); to get the
offset of any function in your code. Using this same
method, you can also print the offset of anything that
can be labeled in your code.
These offsets are only useful for mental
masturbation. If your application needs to know
the layout of its code and data it is severely
broken and needs to be fixed. All data elements
are accessible using conventional language methods
such as pointers, array elements, and structure
members.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by John Ashcroft.
98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/