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

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

Rounds the given size to a multiple of thew alignment

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.

empty
Ternary empty()

Standard allocator API.

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

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.

goodAllocSize
size_t goodAllocSize(size_t n)

Rounds the given size to a multiple of thew alignment

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.

Static variables

instance
SbrkRegion instance;

Instance shared by all callers.

Variables

alignment
enum uint alignment;

Standard allocator primitives.

Meta