I am not sure which is the right mailing list, so sorry about the
cross-posting:

I want to use a lot of memory in my program, so I set the following in
/boot/loader.conf:
kern.maxdsiz=2147483648
kern.maxssiz=2147483648
kern.dfldsiz=2147483648

Then I run this simple program:

#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>

int main() {
  struct rlimit rlp;

  getrlimit(RLIMIT_STACK,&rlp);
  fprintf(stderr,"%lld %lld\n",rlp.rlim_cur,rlp.rlim_max);
  rlp.rlim_cur = 512*1024*1024;
  fprintf(stderr,"%lld %lld\n",rlp.rlim_cur,rlp.rlim_max);
  setrlimit(RLIMIT_STACK,&rlp);
  exit(0);
}

and it crashes like this:

2147483648 2147483648
536870912 2147483648
Bus error (core dumped)

Maybe I am expecting too much from the system.  I have a dual Athlon MP
system with about 3G of RAM, and I want to be able to use a good portion
of this RAM in a single process.  But I also want to use linuxthreads so
that I can take advantage of the two processors.  But linuxthreads uses
setrlimit, and crashes in a similar way to my simple program.

I looked at the kernel code in /usr/src/sys/kern/kern_resource.c at the
function dosetrlimit, which I guess is where the action takes place, but
I have no idea what to make of it.




-- 
Stephen Montgomery-Smith
[EMAIL PROTECTED]
http://www.math.missouri.edu/~stephen

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to