[#BloombergLP-bslma-Default-setDefaultAllocator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/Default.adoc[Default]::setDefaultAllocator :relfileprefix: ../../../ :mrdocs: Set the address of the default allocator to the specified `basicAllocator` unless calls to this method have been disabled. Return 0 on success and a non‐zero value otherwise. This method will fail if either `defaultAllocator`, `lockDefaultAllocator`, or `allocator` with argument 0 has been called previously in this process. In C++17 and later, a successful call to this method will also set the default `std::pmr::memory_resource`. The behavior is undefined unless `basicAllocator` is the address of an allocator with sufficient lifetime to satisfy all allocation requests within this process, and unless there is only one thread started within this process. Note that this method is intended for use _only_ by the _owner_ of `main` (or for use in _testing_) where the caller affirmatively takes responsibility for the behavior of all clients of the default allocator, and should _not_ be used for any other purpose. == Synopsis Declared in `<bslma_default.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int setDefaultAllocator(xref:BloombergLP/bslma/Allocator.adoc[Allocator]* basicAllocator); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#