Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Releasing/Deallocating pointers #9

Open
skiwi2 opened this issue Jul 25, 2014 · 2 comments
Open

Releasing/Deallocating pointers #9

skiwi2 opened this issue Jul 25, 2014 · 2 comments

Comments

@skiwi2
Copy link

skiwi2 commented Jul 25, 2014

In your examples I often see things like:

Tesseract.TessBaseAPIInit2(handle,
    Pointer.pointerToCString("E:\\Masterarbeit\\Ressourcen\\tessdata"),
    Pointer.pointerToCString("deu-frak"), OCREngineMode.DEFAULT);

I am currently investigating a memory leak in my application, and therefore I am wondering, should we not clean up those Pointer<Byte> that the Pointer.pointerToCString() makes, via Pointer#release?

@skiwi2
Copy link
Author

skiwi2 commented Jul 25, 2014

After more investigating figured out that usage of the following is necessary for it to not leak memory:

  • TessChoiceIteratorDelete(choiceIterator);
  • //TessPageIteratorDelete(pageIterator); //TODO get this working, may still have a memory leak here
  • TessResultIteratorDelete(resultIterator);
  • TessBaseAPIDelete(api);

Unfortunately TessPageIteratorDelete(pageIterator) seems to crash the JVM, could you try to confirm and possibly fix the issue?

@pvorb
Copy link
Member

pvorb commented Jul 29, 2014

Yes it does. And I have no idea how to deal with it. :(

We probably should check if it fails in a C/C++ program too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants