Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Jun 2002 22:48:50 -0500
From:      Stephen Montgomery-Smith <stephen@math.missouri.edu>
To:        freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org
Subject:   setrlimit and large maxssiz
Message-ID:  <3D02D022.6B225464@math.missouri.edu>

next in thread | raw e-mail | index | archive | help
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
stephen@math.missouri.edu
http://www.math.missouri.edu/~stephen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D02D022.6B225464>