LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2019, 02:53 PM   #1
resres
LQ Newbie
 
Registered: Mar 2019
Posts: 1

Rep: Reputation: Disabled
C memory layout


How I can see how the c program layouts it`s memory(how and where is stored in cache, ram ,swap). I want to see the mapping of an array to the cache/ram .
 
Old 03-14-2019, 07:53 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
For starters run it under the debugger and view the addresses.

As far as swap goes, I don't know if there are any programming API functions for monitoring it, but I assume there may be some.

Recommend you check the Linux kernel mem source for that information.
 
Old 03-15-2019, 07:29 AM   #3
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Rep: Reputation: 220Reputation: 220Reputation: 220
Check /proc/pid/maps. In man proc it says:
Code:
A file containing the currently mapped memory regions and their access permissions.  See mmap(2) for some further information about memory mappings.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting the correct keyboard layout corresponding to my laptop's physical layout nidra Linux - Newbie 2 08-28-2017 08:14 AM
Fedora13 - KDE 4.4.5, KXKB won't change layout if particular layout is selected CzarEjey Linux - Desktop 0 09-03-2010 02:12 AM
Linux shared memory segment access problem and x86 Virtual Memory layout. regmee Linux - Kernel 1 08-23-2008 12:11 AM
Switching keyboard layout - Mandriva2006 - K.D.E. Windows Layout! itz2000 Mandriva 3 08-13-2006 06:43 PM
Help!?! RH 8 Memory Mapping -High Memory-Virtural Memory issues.. Merlin53 Linux - Hardware 2 06-18-2003 04:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration