[linux-help] Re: How to get more virtual memory?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
"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?
Check errno to see what the error code is. It is possible
that an rlimit (e.g., RLIMIT_DATA) is too low. You can use
setrlimit(2) to bump it up, but have to be root to go over
the default maximum. Don't know how default rlimits are set
on Linux.
I don't know what all else could restrict your ability to
malloc, but shared libraries, shm, and mmap all pin down
address space, which may make it hard to get contiguous
virtual address space and/or artifically limit data size.
One thing you should consider is using mmap(2) to page
in your large file, instead of malloc() and read().
mmap should be faster (pages fault in instead of
passing through the buffer cache), and if you call
it read-only you won't be using any swap memory.
--
/*
* 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
|
|