fix a bug that could cause a crash when freeing memory with memory pressure and slightly reduce app size