[linux-help] Re: How to get more virtual memory?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
What Jeff says below would be true if VM really was ideally
flexible, so you really could use it all up to its maximum
size. However, there are a number of factors, both in your
program's address space and in the kernel itself that make
it a bit less than ideal.
A couple of other things:
-- On my machine, RLIMIT_DATA is infinite. I didn't do anything
to my machine to change the default; yours is probably the
same. The way I test this is to run ftwalk -i, then:
%x getrlimit(DATA).cur
You probably don't have ftwalk :) This is basically:
#include <unistd.h>
#include <stdio.h>
int main() {
printf("%x\n", getrlimit(RLIMIT_DATA).rlim_cur);
return 0;
}
-- You can look at /proc/PID/maps to get an idea of your address
space map. It looks to me like the Linux default is to load
text low (08048000), data above that, then grow the heap up.
Stack starts at (c0000000) and goes down. Shared libraries
get mapped starting at (4000000), i.e., 1GB, which seems to
squeeze your heap to 1GB - text+data. I say "seems", because
a clever malloc() implementation could get memory from mmap
MAP_ANONYMOUS, and mmap probably gets address space above
1GB (up to the stack under 3GB).
-- You can also look at /proc/PID/status, which has some figures
for VmSize, VmData, VmRSS, etc. It wouldn't be a bad idea
just to cat this file out when you get ENOMEM.
-- /proc/meminfo and /proc/swaps are also interesting.
Jeff wrote:
>
> On Wed, 21 Jun 2000, Bates, Rod wrote:
>
> > I am running a program on a large input file that runs out of
> > virtual memory. malloc is returning zero after having
> > allocated ~248 meg. I believe I have more swap space than
> > this. How do I increase the limit?
>
> Well, if malloc returns zero, then you're outta virtual memory,
> just like you say :)
>
> You can verify the background details with "free" and seeing what
> the kernel thinks you have for RAM and swap. The kernel may try
> to keep some other programs in RAM, so you may not end up with the
> full (RAM amount here) megs in your program.
>
> One thing I'd check is that your program isn't:
> a) leaking memory
> b) using more memory than it needs to get the job done
>
> About the only other options I see are:
> 1) add RAM
> 2) add swap space
>
> -jeff
> --
> "This store is open 24 hours a day. It puts great demands on my time."
> -- Apu, from _The Simpsons_
>
> -- This is the linux-help@xxxxxxxxx list. To unsubscribe,
> visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
--
/*
* Tom Hull * thull@xxxxxxxxxxx * http://www.ocston.org/~thull/
*/
-- This is the linux-help@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
|
|