Revert "Thread safe code bug"

This reverts commit 217447895d9f748a04b8745202d6e5d11dfed432.
modified:   corelib/memory.c