[GRASS-dev] v.in.ogr eats all memory

Glynn Clements glynn at gclements.plus.com
Fri May 19 11:20:47 EDT 2006


Hamish wrote:

> > Question: Can we add some test to avoid that more
> > than xx percent of the memory are used? There won't
> > be any hot plugin of extra RAM, so v.in.ogr should
> > exit with memory allocation error.
> 
> attempt G_malloc(),G_free() of estimated size before processing.

That won't necessarily help.

The underlying brk/sbrk (or mmap(MAP_ANONYMOUS)) call will succeed so
long as there is sufficient virtual memory and you don't exceed any
usage limits which are in force.

That doesn't mean that reading/writing the allocated memory won't
cause the system to go into a swapping frenzy.

> Back in
> the mailing list archives somewhere I figured out the current bytes per
> vector point needed (with valgrind) and suggested this?
> 
> I don't know how to query available memory in a cross platform way.

The "free" command will give you some global memory statistics. 
However, that information is practically meaningless to an
application, as there is no way to figure out how much of that memory
you can reasonably expect to use.

On a lightly-loaded system, the application can expect to be able to
use all of the memory which is currently being used by the buffer
cache (which is usually most of the total memory). On a heavily-loaded
system, it may only be able to use a small fraction of it.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list