reiners++at++igd.fhg.de
Sat, 30 Sep 1995 01:04:40 +0100
This is one of the problems I've run into, too. At arena creation time you have
to specify the maximum size your arena can have. If you ever exceed that size
you'll get no more mem.
My solution was to estimate how much I could reasonably get with the following
code snippet:
#include <sys/resource.h>
#include <sys/swap.h>
#include <invent.h>
#include <sys/invent.h>
{
struct rlimit data, vmem;
off_t swap;
long size;
inventory_t *inv;
swapctl(SC_GETFREESWAP, &swap); swap*=512;
getrlimit(RLIMIT_VMEM, &vmem);
getrlimit(RLIMIT_DATA, &data);
for (inv=getinvent(); inv &&
(inv->inv_class!=INV_MEMORY || inv->inv_type!=INV_MAIN);
inv=getinvent());
size=min(min(data.rlim_cur, vmem.rlim_cur), (swap+inv->inv_state)*.9);
usconfig(CONF_INITSIZE, size);
}
This will allocate an arena size of the minimum of
- maximum process data size, as defined by setrlimit
- maximum process virtual memory size, as defined by setrlimit
(these are usually 512MB)
- 90% of (free swap space + main memory size)
It think this makes sense, but any comments are welcome.
BTW, I thought the default size was 64K, so if you don't set any, you should
have had the problem much earlier.
Dirk
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:55 PDT