Skip to content

Commit fa5bc28

Browse files
authored
Add some documentation to emscripten_xxx_heap functions. NFC (#22871)
Many of these function deal with the WebAssembly memory and not what is commonly thought of as the heap (which normally refers to the sbrk/malloc region specifically).
1 parent bd16cd0 commit fa5bc28

File tree

1 file changed

+12
-8
lines changed
  • system/include/emscripten

1 file changed

+12
-8
lines changed

system/include/emscripten/heap.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,25 @@
2020
extern "C" {
2121
#endif
2222

23-
// Returns a pointer to a memory location that contains the heap DYNAMICTOP
24-
// variable (the end of the dynamic memory region)
23+
// Returns a pointer to a memory location that contains the current sbrk
24+
// location (which marks the end of the dynamic memory region used for malloc,
25+
// etc).
2526
uintptr_t *emscripten_get_sbrk_ptr(void);
2627

27-
// Attempts to geometrically or linearly increase the heap so that it
28-
// grows to the new size of at least `requested_size` bytes. The heap size may
29-
// be overallocated, see src/settings.js variables MEMORY_GROWTH_GEOMETRIC_STEP,
28+
// Attempts to geometrically or linearly increase the size of the WebAssembly
29+
// memory (referred to as heap for legacy reason) so that its new size is at
30+
// least `requested_size` bytes. The size may be overallocated, see
31+
// src/settings.js variables MEMORY_GROWTH_GEOMETRIC_STEP,
3032
// MEMORY_GROWTH_GEOMETRIC_CAP and MEMORY_GROWTH_LINEAR_STEP. This function
31-
// cannot be used to shrink the size of the heap.
33+
// cannot be used to shrink the size of the memory.
3234
int emscripten_resize_heap(size_t requested_size) EM_IMPORT(emscripten_resize_heap);
3335

34-
// Returns the current size of the WebAssembly heap.
36+
// Returns the current size of the WebAssembly memory (referred to as heap for
37+
// legacy reason).
3538
size_t emscripten_get_heap_size(void);
3639

37-
// Returns the max size of the WebAssembly heap.
40+
// Returns the max size of the WebAssembly memory (referred to as heap for
41+
// legacy reason).
3842
size_t emscripten_get_heap_max(void);
3943

4044
// Direct access to the system allocator. Use these to access that underlying

0 commit comments

Comments
 (0)