Memory leak caused by inability to notify Julia GC about memory allocated by C++ #73
Description
I was tracking the cause behind a memory leak related to a CxxWrap based project. https://stackoverflow.com/questions/64978891/how-do-i-fix-a-julia-opencv-cxx-memory-leak-in-image-capturing
It seems that Julia's garbage collector does not realize the actual size of objects allocated by C++ and this can cause a memory leak like scenario because the garbage collector isn't destroying objects whose references have already been lost. The underlying issue is that to Julia's garbage collector all C++ allocated objects appear as the size of a pointer. A manual GC run is able to free lost references correctly so the only issue is of having the GC run automatically when needed.
The solution probably involves some way of making Julia GC aware of the real size of objects being allocated by C++ so that the GC can run automatically at appropriate times.