-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ObjectPool逻辑可能有问题 #21
Comments
对象池的使用逻辑或者说流程,应该是(1)对象池初始化,(2)获取对象,(3)回收对象,(4)重复2,3 若干次,(5)对象池销毁或者析构。你所说的第二次删除应该是指(5)。 |
@kikyoo
获取对象的时候在池中删除,并没有给新的删除器. 所以在第二次取出来的时候已经是个普通的 想对照的看SimpleObjectPool.hpp的处理:
|
确实有这个问题,楼上说的对 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ObjectPool的Init中:
当对象第一次被回收之后重新加入map时没有再次添加删除器,那么第二次删除之后就没有了。但第三次再次获取时就会获得空指针,如:
The text was updated successfully, but these errors were encountered: