Hi, On Thu, Dec 2, 2010 at 12:51 PM, Andrew Duane <adu...@juniper.net> wrote: > > I've been poking at some bugs we have around pushing user memory to/past the > limits of our box, and decided to try seeing what happens on a stock FreeBSD > system (7.1 in this case). > > Basically I have a program that mallocs big memory chunks and zeros them to > consume both physical and virtual memory. I had expected the program to stop > malloc'ing when brk() reaches the process' RLIMIT_DATA (512MB cur and max). > It didn't. It happily malloc'd many gigabytes of memory until I stopped it. > > On our 6.2 based product boxes, RLIMIT_DATA correctly stops the malloc from > continuing, just like the manuals say. > > Am I missing something?
Perhaps that malloc has two ways of grabbing memory from system -- sbrk() and mmap() and they are subject to different limits. I believe these days malloc is allowed to use both but prefers mmap which would explain why RLIMIT_DATA didn't have much effect. Try forcing malloc to use sbrk only via MALLOC_OPTIONS=Dm (not sure if that's correct way to specify my intent, though). --Artem _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"