I noticed that the allocation didn't climb with each use, which suggests it may be re-used a few times, or a single allocation that takes care of a few calls before its returned - either of which would make an external delete like that unsafe.
Have you stepped through the source-code to be sure you're not messing up anything internally by deleting it like that?
Starting to step through the source-code for it myself, it looked like that it was not all written in a straight-forward way, and I really don't want to take the time to figure out what they were doing. So I've just replaced all those function calls with my own function. Solved for me
Besides, allocating and de-allocating memory during the main runtime loop is a big a no-no (as far as I'm concerned). The Windows memory manager has historically not been that reliable. Who knows what junk and/or fragmentation might accumulate there? Secondly, the calls to new
are very slow. I found this out the hard way when I wrote my first incarnation of a memory management class.
Judging what we see is the greatest blinder and self-limiter in the universe.
What we perceive is never reality. It is only a story we tell ourselves based on our current perspective, which has far more to do with our beliefs about ourselves than with anything else.