SbrkRegion

Allocator backed by $(LINK2 https://en.wikipedia.org/wiki/Sbrk, sbrk) for Posix systems. Due to the fact that sbrk is not thread-safe by design, SbrkRegion uses a mutex internally. This implies that uncontrolled calls to brk and sbrk may affect the workings of SbrkRegion adversely.

Members

Functions

empty
Ternary empty()

Standard allocator API.

Static functions

alignedAllocate
void[] alignedAllocate(size_t bytes, uint a)
allocate
void[] allocate(size_t bytes)

Standard allocator primitives.

deallocate
bool deallocate(void[] b)

The deallocate method only works (and returns true) on systems that support reducing the break address (i.e. accept calls to sbrk with negative offsets). OSX does not accept such. In addition the argument must be the last block allocated.

deallocateAll
bool deallocateAll()

The deallocateAll method only works (and returns true) on systems that support reducing the break address (i.e. accept calls to sbrk with negative offsets). OSX does not accept such.

expand
bool expand(void[] b, size_t delta)
owns
Ternary owns(void[] b)

The expand method may only succeed if the argument is the last block allocated. In that case, expand attempts to push the break pointer to the right.

Variables

alignment
enum uint alignment;

Standard allocator primitives.

instance
enum SbrkRegion instance;

Instance shared by all callers.

Meta