Skip to content

Commit

Permalink
[test] Avoid EM_ASM in test_mallinfo. NFC (#23346)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Jan 9, 2025
1 parent 61778f2 commit d6aabb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/core/test_mallinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
#include <unistd.h>
#include <assert.h>
#include <malloc.h>
#include <emscripten/em_asm.h>
#include <emscripten/heap.h>

size_t getTotalMemory() {
return (size_t)EM_ASM_PTR(return HEAP8.length);
return emscripten_get_heap_size();
}

size_t getFreeMemory() {
struct mallinfo i = mallinfo();
uintptr_t totalMemory = getTotalMemory();
uintptr_t dynamicTop = (uintptr_t)sbrk(0);
size_t totalMemory = getTotalMemory();
size_t dynamicTop = (size_t)sbrk(0);
return totalMemory - dynamicTop + i.fordblks;
}

Expand Down

0 comments on commit d6aabb2

Please sign in to comment.