-
Notifications
You must be signed in to change notification settings - Fork 199
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
Buffer overflow with memory_pool_collection #99
Comments
So sorry for the delay, feel free to ping me in the future after a week or so. Issue is now fixed. Note that memory_pool and also memory_pool_collection aren't ideal for array allocations as done by std::vector. They're best if you need to allocate many individual objects, like in a linked list, for example. It still works, but is not as efficient. BTW, you don't need |
Thanks a lot, the fix works perfectly fine. @foonathan what would you consider the best practise with your library for I know that the first thing I should do is measure and I also understand that in general a Wouldn't Or would you say that the code is badly written and I should avoid such situations and make sure I am always using a temporary or stack allocator ? |
It depends on your use case.
Note that small buffer optimization is not possible with allocators alone. You might find https://github.com/foonathan/array interesting. |
Clear explanation, thanks a lot for your help ! |
Hello,
memory_pool_collection
reports a buffer overflow on deallocation. I might be doing something wrong...Here is the code that fails on my machine (linux x64)
the output of the program:
the stacktrace:
and the memory content:
Thanks in advance for the help.
The text was updated successfully, but these errors were encountered: