在Boost Singleton池中,purge_memory
和release_memory
的区别在哪里?在这里中,它说:
Singleton使用是一种方法,其中每个池都是一个具有静态持续时间的对象;也就是说,在程序退出之前不会销毁它。单例使用的池对象可能是共享的;因此,单例使用也意味着线程安全。具有单例用法的池对象分配的系统内存可以通过
release_memory
或purge_memory
释放。
发布于 2020-01-09 07:19:03
单击页面上的几个链接将导致到本页。
在这里,您可以阅读以下内容:
t.release_memory() bool t must be ordered. Frees every memory block that doesn't have any
allocated chunks. Returns true if at least one memory block was freed.
t.purge_memory() bool Frees every memory block. This function invalidates any pointers
previously returned by allocation functions of t. Returns true if at
least one memory block was freed.
https://stackoverflow.com/questions/59658506
复制相似问题