See also on the forum:
On deletion of TMemFile, there is a dereference of a NULL pointer in RecursiveRemove.
Contrary to what is said on the forum, it is not enough to lock around the deletion. The lock needs to be around the TMemFile constructor (see also attached script for a reproducer with ACLiC).
Note that helgrind is unhappy in all cases, claiming that the destructor of TThreadCleaner unlocks a mutex that is not locked. The problem mutexes are two: fgMainMutex and gMainInternalMutex, neither of which is locked before being unlocked in the TThread::CleanUp(). Removing both cleanups makes helgrind (somewhat more) happy, but does nothing for requiring the lock around the TMemFile constructor.
It is not clear to me where the problem in the TMemFile destructor is. Helgrind is unhappy about the TUUID constructor combined with TUnixSystem::DispatchOneEvent(). Both end in TUnixSystem::TimeNow.