View source code
Display the source code in std/experimental/allocator/building_blocks/region.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Struct std.experimental.allocator.building_blocks.region.SharedRegion
The threadsafe version of the Region
allocator.
Allocations and deallocations are lock-free based using cas
.
struct SharedRegion(ParentAllocator, uint minAlign = platformAlignment, Flag!("growDownwards") growDownwards = No .growDownwards)
;
Constructors
Name | Description |
---|---|
this
|
Constructs a region backed by a user-provided store.
Assumes the memory was allocated with ParentAllocator
(if different from NullAllocator ).
|
Fields
Name | Type | Description |
---|---|---|
parent
|
ParentAllocator | The parent allocator. Depending on whether ParentAllocator holds state
or not, this is a member variable or an alias for
ParentAllocator .
|
Methods
Name | Description |
---|---|
alignedAllocate
|
Allocates n bytes of memory aligned at alignment a .
|
allocate
|
Allocates n bytes of memory. The allocation is served by atomically incrementing
a pointer which keeps track of the current used space.
|
deallocate
|
Deallocates b . This works only if b was obtained as the last call
to allocate ; otherwise (i.e. another allocation has occurred since) it
does nothing.
|
deallocateAll
|
Deallocates all memory allocated by this region, which can be subsequently reused for new allocations. |
empty
|
Returns Ternary if no memory has been allocated in this region,
Ternary otherwise. (Never returns Ternary .)
|
goodAllocSize
|
Rounds the given size to a multiple of the alignment
|
owns
|
Queries whether b has been allocated with this region.
|
Aliases
Name | Description |
---|---|
alignment
|
Alignment offered. |
Authors
License
Copyright © 1999-2018 by the D Language Foundation | Page generated by ddox.