14#define LOGE(...) __android_log_print(ANDROID_LOG_DEBUG,"SCEngineMomory",__VA_ARGS__)
15#include <android/log.h>
26MemoryMgr::MemoryMgr() =
default;
28MemoryMgr::~MemoryMgr() =
default;
31void MemoryMgr::ExterminateObjects(
bool killAll) {
33 auto iter = m_objects.begin();
34 while (iter != m_objects.end()) {
36 if (
object ==
nullptr) {
42 OutputDebugStringA(
"Auto Releasing Object : ");
43 OutputDebugStringA(
typeid(*object).name());
44 OutputDebugStringA(
"...\n");
46 LOGE(
"Auto Releasing Object : UNKOWN...");
48 std::cout <<
"Auto Releasing Object : " <<
typeid(*object).name() <<
"...\n";
50 if (object->isUndestroyable && !killAll) {
52 OutputDebugStringA(
"denied.\n");
60 object->Exterminate();
61 iter = m_objects.erase(iter);
62 m_hashContainer.erase(object->GetHash());
65 OutputDebugStringA(
"deleted.\n");
69 std::cout <<
"deleted.\n";
73 m_objects.erase(std::remove(m_objects.begin(), m_objects.end(),
nullptr), m_objects.end());
77void MemoryMgr::ReleaseObject(
SObject*
object,
bool isForce) {
78 if (
object ==
nullptr)
return;
80 if (object->isUndestroyable && !isForce) {
82 OutputDebugStringA(
"Releasing Object is denied.");
84 LOGE(
"Releasing Object is denied.");
89 auto iObj = std::find(m_objects.begin(), m_objects.end(),
object);
91 if (iObj != m_objects.end()) {
93 OutputDebugStringA(
"Releasing Object : ");
94 OutputDebugStringA(
typeid(*object).name());
95 OutputDebugStringA(
"...\n");
97 LOGE(
"Releasing Object : UNKOWN...");
99 object->Exterminate();
104 OutputDebugStringA(
"deleted\n");
111void MemoryMgr::Init() {