bitshifter / objectpool Goto Github PK
View Code? Open in Web Editor NEWObject pool implementation in C++11
License: zlib License
Object pool implementation in C++11
License: zlib License
Hi @bitshifter , I'm wondering if the objectpool can be used in a multi-threaded case. That means mulitple threads share one object pool to get and return objects. Is it safe? will there be any race condition issues?
vs2015, x64 error
struct Node { void* p1; };
int main()
{
FixedObjectPool<Node> pool(1);
reutrn 0;
}
error in
object_pool.inl
ObjectPoolBlock<T>* ObjectPoolBlock<T>::create(index_t entries_per_block)
{
……
assert(reinterpret_cast<uint8_t*>(ptr->memory_begin())
== reinterpret_cast<uint8_t*>(ptr) + header_size + indices_size);
……
}
you use realloc to add block ,but realloc may return a pointer
different from the previous, if this happen,
all the allocated object pointer will be invalid.
this is a serious issue.
so i advise not to use realloc, but alloc a new chunk, then use
lists to connect the chunks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.