LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 03-30-2010, 03:45 PM   #1
jaewlee
LQ Newbie
 
Registered: Mar 2010
Distribution: Ubuntu
Posts: 3

Rep: Reputation: 0
What is the maximum allocatable heap size for a process?


I'm wondering what's the maximum heap space a process can use (not necessarily by a single malloc()) in Ubuntu x86_64. Which parameter determines the size?

Thanks.
 
Old 04-01-2010, 01:04 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Though I do not have a direct answer to your question but still you can look at the pmap command.

and IMO you should have posted this question in the programming forum instead of this Ubuntu forum as

I read your question as follows:
"What is the maximum allocatable heap size for a process in a 64 bit Linux OS ?"

Here Ubuntu or redhat does not matter I suppose .

Last edited by Aquarius_Girl; 04-01-2010 at 02:54 AM.
 
Old 04-01-2010, 02:35 PM   #3
jaewlee
LQ Newbie
 
Registered: Mar 2010
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: 0
pmap gives you information about the *current* memory usage of a process, but not about the *maximum possible* message usage.

I'll post this kind of questions in the programming forum later on.

Thanks for your reply and suggestion.
 
Old 04-01-2010, 02:47 PM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by jaewlee View Post
I'm wondering what's the maximum heap space a process can use (not necessarily by a single malloc()) in Ubuntu x86_64. Which parameter determines the size?
You might get a better answer if you explain why you want to know.

For most purposes, the answer is "bigger than the practical limits".

If you plan to actually use the heap space, you need your swap space plus a moderate fraction of your ram space to exceed the total heap allocation.

I'm not sure of the actual limits nor the parameters to tweak them, but I'm pretty sure that for any reasonable cost PC you won't have enough swap space to approach the limit before you exceed the practical limit.

If you want to allocate a lot of heap but not actually use it, so you want to be immune from the check that there is enough swap space, you can change the parameters controlling over commit checking.

Since no one is expected to hit the implemented limit before hitting a lower practical limit from swap size, I expect most Linux experts could not tell you the implemented limit.

The theoretical limit from the architecture would be nearly 128TB. Possibly, there is no Linux implementation detail cutting you short of that theoretical limit. So if you had 128TB of disk space and made it all into swap partitions, you could use 128TB of heap. Or maybe there are some limits on number of swap partitions and size of swap partitions that would leave you well short of 128TB even if you could attach that much disk space. I don't know those details.

Last edited by johnsfine; 04-01-2010 at 02:56 PM.
 
Old 04-01-2010, 11:46 PM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by jaewlee
pmap gives you information about the *current* memory usage of a process, but not about the *maximum possible* message usage.

I'll post this kind of questions in the general forum later on.

Thanks for your reply and suggestion.
I had tested the pmap command before posting the reply . I know it shows only the current memory usage !

Actually I had reported your thread to the moderators for being moved to the programming forum, but may be the moderators had different views so they didn't move it !

I waited for one day but no one replied to your question.

Then I thought mentioning the pmap command as a reply will give a bump to your thread and then may be some senior programmer will see it !

That all the story

Last edited by Aquarius_Girl; 04-02-2010 at 09:52 PM.
 
Old 04-02-2010, 10:24 AM   #6
jaewlee
LQ Newbie
 
Registered: Mar 2010
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks, anishakaul. Your action was very considerate. :-)

johnsfine, thanks for your reply. What I'm trying to do is statically partition the entire heap space into multiple sub-heaps. So, I needed to know what's the maximum theoretical limit of heap space. How did you get the number "128TB"?
 
Old 04-02-2010, 10:36 AM   #7
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
In X86_64 architecture, the top 17 bits of any pointer must be all copies of the same bit value (all ones if the pointer is in kernel space and all zeroes if the pointer is in user space).

So a user space pointer has its top 17 bits zero and its bottom 47 bits available to address 128TB of memory.

Quote:
Originally Posted by jaewlee View Post
What I'm trying to do is statically partition the entire heap space into multiple sub-heaps.
I expect that means you will be allocating virtual address space far in excess of the amount the swap file size would let you actually use.

To do that, you probably need to change vm.overcommit_memory to 1.
As root, execute the command
/sbin/sysctl vm.overcommit_memory=1

Last edited by johnsfine; 04-02-2010 at 10:43 AM.
 
Old 04-02-2010, 09:53 PM   #8
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by jaewlee
Thanks, anishakaul. Your action was very considerate. :-)
Most welcome !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
copy_from_user does not copy from process-heap najoshi Linux - Kernel 0 08-16-2009 12:09 AM
get the heap size from a specific process in linux powah Linux - General 3 01-04-2008 05:16 PM
How to increase Heap Size? rajat Programming 1 08-01-2007 06:33 AM
increasing heap size podollb Linux - Software 3 03-06-2005 11:42 PM
Modifying the heap available to a process exitsfunnel Linux - Software 0 12-10-2003 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 01:44 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