emscripten links against dlmalloc.c in system/lib, and the best function to get the size of an allocated chunk of memory should be malloc_usable_size(), but note that this can return a different number then passed to malloc().
Cheers, -Floh. Am Dienstag, 7. Januar 2014 15:26:14 UTC+1 schrieb Konstantin Ivanov: > > Hello! > > If we can allocate memory by > var ptr = Module._alloc(size); > > and then free this mem using only ptr by > Module._free(ptr); > > Then it should be possible to recognize size of allocated memory area only > by pointer? It is may be like > var size = Module._sizeof(ptr); > > I have tried to find implementation of _malloc and _free, but found it > only for "CORRUPTION_CHECK = 1" case in CorruptionChecker. > > Please, point me to source *.js where I can find _malloc and _free > algorithms. > > Also, if you have critical notes about recognizing memory block size by > its pointer then it would be useful for me to find out this notes. > > Thanx! > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
