Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 2013 06:42:20 +0000
From:      Ben Morrow <ben@morrow.me.uk>
To:        unga888@yahoo.com, freebsd-stable@freebsd.org
Subject:   Re: FreeBSD 9.1 excessive memory allocations [SOLVED]
Message-ID:  <20130328064216.GA30925@anubis.morrow.me.uk>
In-Reply-To: <1364449156.30979.YahooMailNeo@web161906.mail.bf1.yahoo.com>
References:  <1364322902.78474.YahooMailNeo@web161904.mail.bf1.yahoo.com> <1364393170.36972.49.camel@revolution.hippie.lan> <1364409226.37379.YahooMailNeo@web161906.mail.bf1.yahoo.com> <1364410923.36972.67.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoth Unga <unga888@yahoo.com>:
> 
> > I think you may be reading too much into the malloc manpage.  When it
> > mentions the use of per-thread small-object caches to avoid locking it's
> > talking about performance, not thread safety.  Allocations of all sizes
> > are thread-safe, the library just assumes that huge allocations are rare
> > enough that it doesn't use extra per-thread resources to avoid locking
> > for them, it just uses locking for huge blocks.
> 
> Good to note all allocations are thread safe in FreeBSD. Is it by some
> standard that malloc should be thread safe regardless the OS (BSDs,
> Linux, Windows, Android, etc)?

POSIX (well, SUSv4 at least) says that malloc and free must be
threadsafe. Note that Windows is not a POSIX system, though I belive
malloc is also always threadsafe on Windows.

Ben




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130328064216.GA30925>