ellie-idb / blocklandjs

BlocklandJS - a implementation of V8 in Blockland. Bad code included.
2 stars 0 forks source link

Make sure that all Persistent handles are released #24

Closed ellie-idb closed 6 years ago

ellie-idb commented 6 years ago

I have no clue if they are. I'm blindly freeing memory- I assume they are, but, to be safe, I should still release them before freeing, or I might run into a UaF issue.

McTwist commented 6 years ago

I would recommend to add some sort of automatic memory handling. If you give memory to the engine, ignore it, as it's freed internally. If you handle the memory yourself, then use std::shared_ptr or equivalent.

If for some reason the engine does not free your memory, then you need to add some sort of event system, that if it is somehow removing the reference but not the memory, you need to know about it and free it yourself.