Hi,

I need to retrieve the size of a buffer that is dynamically allocated and 
this is what I did:


size_t size = 64;
size_t alignment = 8;
memalign(alignment, size);

size_t measuredSize = malloc_usable_size(test);
std::cout << "measuredSize:" << measuredSize << " size:" << size << 
std::endl;

However, the size returned by malloc_usable_size is always 4 more than the 
amount that I pass in to memalign. In this case, measuredSize will be 68. I 
tried using malloc and the result is the same.

Is there a way to get the size that I pass into memalign or can I always 
assume that malloc_usable_size will always report a higher size of 4 bytes?

-- 
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/d/optout.

Reply via email to