Fix memory leaks; Adjust heap & thread stack size (#47)

This commit is contained in:
KazushiM
2022-10-31 11:12:27 +08:00
parent 859841ab8e
commit 2962163f19
4 changed files with 6 additions and 5 deletions

View File

@@ -132,7 +132,7 @@ void FileUtils::RefreshFlags(bool force)
void FileUtils::InitializeAsync() void FileUtils::InitializeAsync()
{ {
Thread initThread = {0}; Thread initThread = {0};
threadCreate(&initThread, _FileUtils_InitializeThreadFunc, NULL, NULL, 0x4000, 0x15, 0); threadCreate(&initThread, _FileUtils_InitializeThreadFunc, NULL, NULL, 0x2000, 0x15, 0);
threadStart(&initThread); threadStart(&initThread);
} }
@@ -228,6 +228,7 @@ void FileUtils::ParseLoaderKip() {
return; return;
} }
} }
closedir(dp);
} }
delete[] full_path; delete[] full_path;
} }

View File

@@ -22,7 +22,7 @@ IpcService::IpcService()
ASSERT_RESULT_OK(rc, "svcGetThreadPriority"); ASSERT_RESULT_OK(rc, "svcGetThreadPriority");
rc = ipcServerInit(&this->server, SYSCLK_IPC_SERVICE_NAME, 42); rc = ipcServerInit(&this->server, SYSCLK_IPC_SERVICE_NAME, 42);
ASSERT_RESULT_OK(rc, "ipcServerInit"); ASSERT_RESULT_OK(rc, "ipcServerInit");
rc = threadCreate(&this->thread, &IpcService::ProcessThreadFunc, this, NULL, 0x2000, priority, -2); rc = threadCreate(&this->thread, &IpcService::ProcessThreadFunc, this, NULL, 0x1000, priority, -2);
ASSERT_RESULT_OK(rc, "threadCreate"); ASSERT_RESULT_OK(rc, "threadCreate");
this->running = false; this->running = false;
} }

View File

@@ -22,7 +22,7 @@
#include "ipc_service.h" #include "ipc_service.h"
#include "oc_extra.h" #include "oc_extra.h"
#define INNER_HEAP_SIZE 0x40000 #define INNER_HEAP_SIZE 0x50000
extern "C" extern "C"
{ {

View File

@@ -170,12 +170,12 @@ void Governor::Start() {
s->self = this; s->self = this;
s->id = core; s->id = core;
int prio = (core == CORE_NUMS - 1) ? 0x3F : 0x3B; // Pre-emptive MT int prio = (core == CORE_NUMS - 1) ? 0x3F : 0x3B; // Pre-emptive MT
rc = threadCreate(&m_t_cpuworker[core], &CpuUtilWorker, (void*)s, NULL, 0x1000, prio, core); rc = threadCreate(&m_t_cpuworker[core], &CpuUtilWorker, (void*)s, NULL, 0x400, prio, core);
ASSERT_RESULT_OK(rc, "threadCreate"); ASSERT_RESULT_OK(rc, "threadCreate");
rc = threadStart(&m_t_cpuworker[core]); rc = threadStart(&m_t_cpuworker[core]);
ASSERT_RESULT_OK(rc, "threadStart"); ASSERT_RESULT_OK(rc, "threadStart");
} }
rc = threadCreate(&m_t_main, &Main, (void*)this, NULL, 0x1000, 0x3F, 3); rc = threadCreate(&m_t_main, &Main, (void*)this, NULL, 0x400, 0x3F, 3);
ASSERT_RESULT_OK(rc, "threadCreate"); ASSERT_RESULT_OK(rc, "threadCreate");
rc = threadStart(&m_t_main); rc = threadStart(&m_t_main);
ASSERT_RESULT_OK(rc, "threadStart"); ASSERT_RESULT_OK(rc, "threadStart");