implement in-memory only mode
fix spinlock bug when compiling with -03