The libatomic_ops_gpl includes a simple almost-lock-free malloc implementation.

This is intended as a safe way to allocate memory from a signal handler,
or to allocate memory in the context of a library that does not know what
thread library it will be used with.  In either case locking is impossible.

Note that the operations are only guaranteed to be 1-lock-free, i.e. a
single blocked thread will not prevent progress, but multiple blocked
threads may.  To safely use these operations in a signal handler,
the handler should be non-reentrant, i.e. it should not be interruptable
by another handler using these operations.  Furthermore use outside
of signal handlers in a multithreaded application should be protected
by a lock, so that at most one invocation may be interrupted by a signal.
The header will define the macro "AO_MALLOC_IS_LOCK_FREE" on platforms
on which malloc is completely lock-free, and hence these restrictions
do not apply.

In the presence of threads, but absence of contention, the time performance
of this package should be as good, or slightly better than, most system
malloc implementations.  Its space performance
is theoretically optimal (to within a constant factor), but probably
quite poor in practice.  In particular, no attempt is made to
coalesce free small memory blocks.  Something like Doug Lea's malloc is
likely to use significantly less memory for complex applications.

Perfomance on platforms without an efficient compare-and-swap implementation
will be poor.

This package was not designed for processor-scalability in the face of
high allocation rates.  If all threads happen to allocate different-sized
objects, you might get lucky.  Otherw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                