[#BloombergLP-bslma-Default-setGlobalAllocator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/Default.adoc[Default]::setGlobalAllocator :relfileprefix: ../../../ :mrdocs: Unconditionally set the address of the global allocator to the specified `basicAllocator`, or to the address of the `NewDeleteAllocator` singleton if `basicAllocator` is 0. Return the address of the global allocator in effect immediately before calling this method. The behavior is undefined unless `basicAllocator` is 0 or is the address of an allocator with sufficient lifetime to satisfy all global allocation requests within this process, and unless there is only one thread started within this process. Note that prior to the first call to this method, the address of the global allocator is that of the `NewDeleteAllocator` singleton. Also 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 global allocator, and should _not_ be used for any other purpose. == Synopsis Declared in `<bslma_default.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bslma/Allocator.adoc[Allocator]* setGlobalAllocator(xref:BloombergLP/bslma/Allocator.adoc[Allocator]* basicAllocator); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#