Purify / Valgrind - doesn't help because it reduces performance of my application and problem was not reproduced.
While reading that, I believe you have not only a memory corruption but also one or more race conditions.
So I would give you the hind to first run with helgrind to find the race conditions. But helgrind is not aware of memory ordering if you use std::atomic
. In this case it reports false positives and is more or less unusable. For that situation I don't know any tool which checks for memory ordering, which is a big problem in the moment.
How can I debug my application without performance degradation?
The question is: Why your failure depends on performance? Do you have I/O in parallel or running multiple tasks/threads? If so, reduce the speed of that tasks or threads or the I/O also, maybe you can force the error to raise.
Hints for slow down other threads/tasks:
On linux you can bind a thread/task to a cpu/core and you hopefully can consume more power on that single core by adding multiple "stopper" tasks also on that core. taskset. You may also compile special parts of your code with -O0
or other hacks.
I know it is quite a nightmare to find bugs which are gone if you have debugging tools in place. But we can not really help, as we have nothing to take a look on... so it is a bit reading the crystal ball!
Corruption occures on hight load.
How do you know? Also: monitor the process's VSIZ+RSS. Could be that you are just leaking memory. – Collenecollet