Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, Is there any way to find that in a process how much memory has been allocated by a .so file dynamically. -- Please suggest Regards, Manish Gurnaney...
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    7

    Memory taken by .So file

    Hi all,
    Is there any way to find that in a process how much memory has been allocated by a .so file dynamically.
    -- Please suggest

    Regards,
    Manish Gurnaney

  2. #2
    Just Joined!
    Join Date
    Jun 2010
    Posts
    3
    Code:
    pmap <pid>
    does the trick

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    7

    Memory taken by .So file

    Hi,
    I have already gone through that option it gives the code segment and Data segment memory properly. But when it comes to heap memory it combines memory of all the .so files and process, and displays.
    My Requirement here is that i want to know in a particular process how much memory of heap is asked for a particular lib file.

    Regards,
    Manish

  4. #4
    Just Joined!
    Join Date
    Jun 2010
    Posts
    3
    I don't know if such a tool exists, but I have a suggestion.

    Use mtrace()/muntrace() to start and stop malloc tracing. When you call muntrace() before freeing memory, it shows up as memory not freed along the address where it was malloced. This list contains all the mallocs, including the ones malloced from .so. To filter just the .so contents, use pmap to find the address range of the .so code. You might have to write a small script to filter the contents based on this address range and add it.

    Hope this helps !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...