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
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
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.
On Thu, 28 Oct 2004, Phy Prabab wrote:
> Is there documentation that
> could help me understand memory management under
> Linux?
>
A few bits and pieces of varying age and level of detail that may be of
interrest :
http://www.skynet.ie/~mel/projects/vm/
http://www.csn.ul.ie/~mel/projects/vm/guide/html/understand/
http://www.phptr.com/title/0131453483
http://linux-mm.org/
http://home.earthlink.net/~jknapka/linux-mm/vmoutline.html
--
Jesper Juhl