Women in Technology

Hear us Roar



Article:
  When Linux Runs Out of Memory
Subject:   Re: Parsing /proc/meminfo before 'malloc'ing
Date:   2008-11-17 22:35:39
From:   dee_
Response to: Re: Parsing /proc/meminfo before 'malloc'ing


Hi Mulyadi,


Thanks for this great article. It is really helpful.


I am facing one problem. I want that my application should be able to find two things:
1) available heap memory
2) largest block of heap memory that it can allocate.


Calculating available free pages and available user space will help me how?
Can you help me in this?


Regards,
Deepak


Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Re: Parsing /proc/meminfo before 'malloc'ing
    2008-12-05 20:12:08  santosam [View]

    Hi Deepak

    Sorry, I know no built-in glibc function that is able to do what you ask. Seems like you have to parse /proc/the-pid/maps by yourself and from there determine the largest VMA block you can allocate.

    Pay attention that you could split the size you ask into smaller parts, since in real situation it's a bit hard to find big continous virtual memory area.

    Sorry if it doesn't help you a lot and thanks for reading my article. Glad you find it useful.

    regards,

    Mulyadi.