Make some tests more frienly to MemoryError.
Free memory, unlock hanging threads.