lkml.org 
[lkml]   [2004]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Help understanding memory layout
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.033 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site