Skip to content

Commit c0fdb7b

Browse files
committed
Made various adjustments for saving memory and making the code easier to read
1 parent d72dce4 commit c0fdb7b

File tree

4 files changed

+222
-218
lines changed

4 files changed

+222
-218
lines changed

ttyd-tools/rel/include/global.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,13 +741,14 @@ struct HeapInfoDisplay
741741
{
742742
int32_t NumHeaps = gc::OSAlloc::NumHeaps;
743743

744+
DisplayHeapInfo = new bool[NumHeaps + 1]; // Add one for the smart heap
745+
744746
// Add one for the smart heap, subtract 1 for not displaying the free portion of the smart heap
745747
int32_t MemoryUsageArrays = ((NumHeaps + 1) * 2) - 1;
746748

747-
DisplayHeapInfo = new bool[NumHeaps + 1]; // Add one for the smart heap
748-
MemoryUsageBuffer = new char *[MemoryUsageArrays];
749+
char **tempMemoryUsageBuffer = new char *[MemoryUsageArrays];
750+
MemoryUsageBuffer = tempMemoryUsageBuffer;
749751

750-
char **tempMemoryUsageBuffer = MemoryUsageBuffer;
751752
for (int32_t i = 0; i < MemoryUsageArrays; i++)
752753
{
753754
tempMemoryUsageBuffer[i] = new char[MEMORY_USAGE_LINE_BUFFER_SIZE];

ttyd-tools/rel/include/main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
namespace mod {
66

77
void fixRoomProblems();
8+
void clearHeapCorruptionBuffer();
9+
void clearMemoryUsageBuffers();
810

911
}

0 commit comments

Comments
 (0)