先上代码:
list<int, fast_pool_allocator<int> > lst;
int i(3);
lst.push_back(i);
上述代码执行完成之后,在MFC工程中就会报出memory leak。
我查看了一下fast_pool_allcator的hpp说明文档如下:
The underlying singleton_pool used by the this allocator
constructs a pool instance that
<b>is never freed</b>. This means that memory allocated
by the allocator can be still used after main() has
completed, but may mean that some memory checking programs
will complain about leaks.
也就是说,fast_pool_allcator使用的singleton_pool是不会主动调用purge_memory来释放内存资源的,那么,怎么破?
请教高手,我如何自己手工实现内存回收?