Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is RapidXml thread safe?

Tags:

c++

rapidxml

The documentation for RapidXml says

Pool maintains RAPIDXML_STATIC_POOL_SIZE bytes of statically allocated memory. Until static memory is exhausted, no dynamic memory allocations are done. When static memory is exhausted, pool allocates additional blocks of memory of size RAPIDXML_DYNAMIC_POOL_SIZE each, by using global new[] and delete[] operators

I interpret this as: RapidXML uses a global memory pool. Are operations on the global memory pool thread safe? I.e. can I use several instances of RapidXML parser throughout my program without having to consider threading issues?

like image 280
Tobias Furuholm Avatar asked Mar 06 '26 08:03

Tobias Furuholm


1 Answers

My interpretation was wrong. The "static memory pool" is an array that is placed on the stack. It is therefore not static as in C++ static array, but rather static as in "not dynamically allocated".

The conclusion: RapidXML does not share the memory pool between instances. The question is therefore invalid.

like image 102
Tobias Furuholm Avatar answered Mar 07 '26 22:03

Tobias Furuholm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!