You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have two instances of allocate() which allocate memory in JS and return to the C caller a c string:
iupemscripten_list.js: var c_str = allocate(intArrayFromString(ret_str), 'i8', ALLOC_NORMAL);
iupemscripten_text.js: var c_str = allocate(intArrayFromString(userText), 'i8', ALLOC_NORMAL);
The caller in C calls free() when it is done with this memory.
Potential problems:
The Emscripten documentation now discourages use of allocate() directly and suggests use _malloc() instead.
It is not clear if free() on the C-side actually and correctly frees memory created by allocate(). Perhaps a cleaner way to handle this is to callback into JavaScript passing back the pointer and calling _free().
The text was updated successfully, but these errors were encountered:
We currently have two instances of allocate() which allocate memory in JS and return to the C caller a c string:
iupemscripten_list.js: var c_str = allocate(intArrayFromString(ret_str), 'i8', ALLOC_NORMAL);
iupemscripten_text.js: var c_str = allocate(intArrayFromString(userText), 'i8', ALLOC_NORMAL);
The caller in C calls free() when it is done with this memory.
Potential problems:
The Emscripten documentation now discourages use of allocate() directly and suggests use _malloc() instead.
It is not clear if free() on the C-side actually and correctly frees memory created by allocate(). Perhaps a cleaner way to handle this is to callback into JavaScript passing back the pointer and calling _free().
The text was updated successfully, but these errors were encountered: