Here is my command: emcc --bind -o test.js C/keyGen/sources/test.cpp -s 
ENVIRONMENT='web' -s MODULARIZE=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=1 
-s SAFE_HEAP=1 -s DETERMINISTIC=1

I experienced weird behaviors when deleting pointers in my C++ program...
before I delete the pointer, it seems like the memory the pointer is 
pointing to has already corrupted.


Do I need to call delete[] ptr if ptr is a class member variable?

Weird things for me: If i try to delete the pointer after use, right before 
the delete[] ptr, the memory that the ptr is pointing to seems 
corrupted...If i don't delete it, the data stays consistent.

Will dynamically allocated array defined in the C++ class be automatically 
freed after the class instance is deleted (or there is no function using 
it)?

Can anybody explain to me how memory allocated for class member variable 
that is a pointer?

Many thanks.

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/7aaf1d72-30ff-4d6e-9cc1-bdf49c4b744ao%40googlegroups.com.

Reply via email to