Fixed a severe memory leak caused by the removal of dynamic memory handling after refactoring the scene manager.