I want to wrap a C++ library using the Java Native Interface. I wonder how memory management can be done, because afaik Object.finalize()
is not garuanteed to be called. I would like to avoid that the user needs to call a free()
method. Also, the library would be used in an embeded system, that means some of the objects are owned by the application and some by the Java runtime. When the Java plugin saves a reference to memory that is owned by the application it may happen that the application has already freed it and therefore the reference is invalid.
Was that clear enough?
Thanks,