Firstly please let me describe the scenario I'm facing:
- I'm trying to use AngelScript in real-time audio processing. There must no locks, and I should not use one global memory pool for many script instances. In addition, the memory pool I'm using does not support multithread access at all.
- Suddenly I attempted to use thread-local instances of memory pool, but it is not valid: some host DAWs maintains a thread pool for audio processing, and the specific thread you use may vary. So if I use a thread-local memory pool, it is possible that AngelScript get allocating in one memory pool but releasing in another, which is fatal.
It seems my only choice is let each script engine instance to use a specific private pool. However, the custom memory allocation mechanism asSetGlobalMemoryFunctions
is a pair of global function, and it does not know which engine instance it is working with. So is there any way to have each engine to use their own pool?