Skip to content

Memory leaks / lifetime best practices #186

Answered by donalffons
prideout asked this question in Q&A
Discussion options

You must be logged in to vote

You are correct, the example code is currently leaking memory left and right. For some smaller applications, this might not be a real problem (if the ocjs life time is relatively short and/or the amount of leaked memory is small). But generally, you would have to do memory cleanup, like you suggested.

The examples / starter templates currently don't do memory cleanup, because I think that makes them easier to read / understand (all the .delete() calls can lead to very lengthy code). But it might be a good idea to have a documentation page on that situation...

Both OpenCascade / OCCT and Emscripten support SmartPointers (OCCT handle or shared_ptr). So, there is a chance that the amount of …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by prideout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants