SceneCoreStandaloneAllocator.cpp 966 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/Memory/SystemAllocator.h>
  9. #include <SceneAPI/SceneCore/SceneCoreStandaloneAllocator.h>
  10. namespace AZ
  11. {
  12. namespace SceneAPI
  13. {
  14. bool SceneCoreStandaloneAllocator::m_allocatorInitialized = false;
  15. void SceneCoreStandaloneAllocator::Initialize()
  16. {
  17. if (!AZ::AllocatorInstance<AZ::SystemAllocator>().IsReady())
  18. {
  19. AZ::AllocatorInstance<AZ::SystemAllocator>().Create();
  20. m_allocatorInitialized = true;
  21. }
  22. }
  23. void SceneCoreStandaloneAllocator::TearDown()
  24. {
  25. if (m_allocatorInitialized)
  26. {
  27. AZ::AllocatorInstance<AZ::SystemAllocator>().Destroy();
  28. }
  29. }
  30. }
  31. }