Skip to content

Instantly share code, notes, and snippets.

@run-dlang
Created April 3, 2018 14:44
Show Gist options
  • Save run-dlang/29aff7add7c27d58dd005aa76073a4fe to your computer and use it in GitHub Desktop.
Save run-dlang/29aff7add7c27d58dd005aa76073a4fe to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io.
void main()
{
import std.experimental.allocator;
import std.experimental.allocator.mallocator: Mallocator;
import std.experimental.allocator.gc_allocator : GCAllocator;
auto newAlloc = sharedAllocatorObject(Mallocator.instance);
processAllocator() = newAlloc;
assert(processAllocator is newAlloc);
processAllocator = sharedAllocatorObject(GCAllocator.instance);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment