optimizate spinlock memory