From dabd6961a674f23ec0df8f2b4d16ba12e1e090e5 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 Apr 2026 08:42:00 +0200 Subject: [PATCH] Couple sizeof(CMemBlock)s (#3143) --- libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h | 2 +- libs/JSystem/src/JKernel/JKRExpHeap.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h b/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h index 1535ba757b..cf6bb819eb 100644 --- a/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h +++ b/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h @@ -35,7 +35,7 @@ public: CMemBlock* getNextBlock() const { return mNext; } u32 getSize() const { return size; } u8 getGroupId() const { return mGroupId; } - static CMemBlock* getBlock(void* data) { return (CMemBlock*)((uintptr_t)data + -0x10); } + static CMemBlock* getBlock(void* data) { return (CMemBlock*)((uintptr_t)data + -sizeof(CMemBlock)); } private: /* 0x0 */ u16 mMagic; diff --git a/libs/JSystem/src/JKernel/JKRExpHeap.cpp b/libs/JSystem/src/JKernel/JKRExpHeap.cpp index 1c6d16c1a9..1f570dd421 100644 --- a/libs/JSystem/src/JKernel/JKRExpHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRExpHeap.cpp @@ -464,7 +464,7 @@ void JKRExpHeap::do_freeAll() { JKRHeap::callAllDisposer(); mHeadFreeList = (CMemBlock*)mStart; mTailFreeList = mHeadFreeList; - mHeadFreeList->initiate(NULL, NULL, mSize - 0x10, 0, 0); + mHeadFreeList->initiate(NULL, NULL, mSize - sizeof(CMemBlock), 0, 0); mHeadUsedList = NULL; mTailUsedList = NULL; #if DEBUG