The boost documentation as below:
Note
The underlying
singleton_poolused by the this allocator constructs a pool instance that is never freed. This means that memory allocated by the allocator can be still used aftermain()has completed, but may mean that some memory checking programs will complain about leaks.
I am confused since I checked the code and the singleton_pool still seem to be created only on the heap of the current process. I.e. if the process is killed by the OS, such pool will be released anyway? Then the above notes merely means if some daemon thread keeps on and such pool is still available after main()? Or it actually means the pool won't be released even after the entire process is killed?
It also seems to me both pool_allocator and fast_pool_allocator are using the identical mechanism to allocate memory i.e. from such a singleton_pool singleton. However this note isn't specified for the fast_pool_allocator. I would reckon both of them behaves the same for such a note above. Am I correct?
Please help. Thanks.
singleton_poolimplements thread-safe(under some conditions) singleton without locks, using the feature of initialization of non-local static variables. The part of source code:non-local variables are initialized as part of program startup, before the execution of the main function begins and get torn down when the program terminates. So that
singleton_poolwill be created before themain(), and destroyed aftermain(). If the process is terminated anyway, of course pool will be released.