title: How to keep a C++ object inside Java code? Possible?
body: <p>First I've got a legacy C++ library, and I'm migrating my app to Android with new UI.</p>
  
  <p>During runtime, there might be multiple C++ objects created and destroyed dynamically. I built a set of JNI native methods to call into library to get that. But where should I keep those C++ objects? I have to keep track of them and free them if they're unnecessary.</p>
  
  <p>So far I only knew Java can't reference to a C++ object. Is it possible to make a Java wrapper class which include a reference to C++ object?</p>
  
  <p>Thanks.</p>