emscripten-core / emscripten-core/emscripten

How do I count the available webassembly memory size ?

Open
#20,243 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

`struct mallinfo2 {
int arena;
int ordblks;
int smblks;
int hblks;
int hblkhd;
int usmblks;
int fsmblks;
int uordblks;
int fordblks;
int keepcost;
};
unsigned int totalMemory = 1023*1024*1024;//EM_ASM_INT(return HEAP8.length);//1023*1024*1024;
unsigned int dynamicTop = (unsigned int)sbrk(0);
struct mallinfo2 mi;
mi = mallinfo2();
unsigned int freeMemory = totalMemory - dynamicTop + mi.fordblks;`

Free memory counted above seems to be the size of unallocated HEAP, but i want to get the size of total free memory size include unallocated and used and free memory

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.