Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Declare factory methods with %newobject
Add the %newobject SWIG declaration to the factory methods createLattice() and createTagger() of the class MeCab::Model. This makes it clear that the caller takes on ownership of the pointer returned by these factory methods. Without this declaration, calls in e.g. Java to Model.createLattice() and Model.createTagger() will leak memory, as the generatedd Java Lattice and Tagger proxy classes do not know that they have ownership of the underlying C++ pointers. As a result, instances of the proxy classes fail to delete the underlying C++ objects, leading to native (off-JVM-heap) memory leaks that are difficult to debug.
- Loading branch information