Gambit startup: "free memory is now less than 20%..." -- crash

Apparently, Gambit checks for "free" memory, disregarding the fact that "cached" memory can be counted as "free" because the OS will empty the cache (write its content to the hard disk) and provide the memory, like it had been free, to the application requesting it.

Consequently, to run Gambit, you must once allocate a sufficient amount of memory manually, so that it is taken from the "cached" category, and then make it available for Gambit.

To do that, first compile the attached C source code: paste it into a file "lim.c" and issue the command "cc -o lim lim.c".

Next, set some limit:

[t]csh:
% limit vmemoryuse 16000m

bash:
% ulimit -v 16000000

The number you use should represent about 25% of the physical memory of your machine.

Now run...
% lim
It will count up to the amount of memory allowed by the limit. (If, for some reason, it counts on beyond that value, make sure you abort it as quickly as possible (press <Ctrl-C>).

After these preparations, you should be able to run Gambit!
/* lim.c */
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <malloc.h>

prtlimit(i,s)
int i;
char *s;
{
struct rlimit rlim;
getrlimit(i,&rlim);
printf("%s limit:n%20d soft limitn%20d hard limitn",
s,rlim.rlim_cur,rlim.rlim_max);
}

main(int argc,char **argv)
{
#define ONE_MEG 1048576
int size;
int n = 1;

if (argc > 1)
{
n = atoi(argv[1]);
if (n < 1 || n > 100000)
n = 1;
}
size = ONE_MEG*n;


prtlimit(RLIMIT_DATA,"RLIMIT_DATA");
prtlimit(RLIMIT_STACK,"RLIMIT_STACK");
prtlimit(RLIMIT_RSS,"RLIMIT_RSS");


{
int M;
register char *s,*t;

printf("nAllocation Chunk = %d MBn", n);


for(M=0; (s = malloc(size)) != 0; ++M)
{
printf("r%5d",M*n); fflush(stdout);
for (t = s+size; t > s; t-=1000)
*t = 'x';
}
printf("nAble to grab %d MBn",M*n);
}
}





Show Form
No comments yet. Be the first to add a comment!