FreeBSD 9.1 excessive memory allocations

Jan Mikkelsen janm at
Wed Mar 27 01:26:03 UTC 2013

On 27/03/2013, at 7:08 AM, Alexander Yerenkow <yerenkow at> wrote:

> 2013/3/26 Tony Li < at>
>>> I have a heavily threaded C application, developed on an Intel Core i5
>> laptop (2 cores) running FreeBSD 8.1-RELEASE.
>>> When this application compile and run on another Intel Core i7 laptop (4
>> cores) running FreeBSD 9.1-RELEASE, this application immediately starts
>> grabbing memory by over 100MB per second and soon exit with not enough RAM.
> Sorry, can't remember exactly, but you could search current- or stable-
> for something like you got.
> This related IIRC with changes in thread subsystem, so basically each
> thread will consume now more mem.
> Search for details, your description is ringing some bell :)

Yes, I remember that too. I think that was linking with libc_r so there was only one kernel thread in the earlier version, but linked with -pthread only in 9-whatever leading to an explosion in the number of kernel threads.

Unga: Have you changed linker options? If so, you may have increased the number of kernel threads, increasing memory requirements. You could experiment with -lkse instead of -lc_r, and calling pthread_set_concurrency(). To manage the number of kernel threads. I haven't tried it, so best of luck.



More information about the freebsd-stable mailing list