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