Text

Answered

"waitForIdle" is causing to huge memory leak

Dear Team,

We are thrilled with the handwriting recognition results. Thanks for the great SDK.

==================================

The only major problem that we are facing is:

- When we requested engine to recognize the handwritten text for a page, when we call "[self.editor waitForIdle];" it's increasing memory by 300MB around as we have many strokes.

- When user closing the book, we are unable to cancel that page recognition process. So the memory keeps increasing till 1GB and our app gets crashing.

==================================

Is there anything that we are missing to release the memory?


Looking forward to hearing from you.


Thanks,

Steve


Best Answer

Dear Steve,


Indeed this is a lot of strokes to process and we can't stop the recognition process when it's ongoing.


You probably should try to send only one recognition process at a time. This check should be done on your side.


Indeed, if a user open a notebook (you send all the strokes immediately), close it right after and open another notebook several times, the memory usage will be huge.

What you can do otherwise is to send the strokes only after a short delay (when you know the user will stay on this notebook page). But i don't know if this is possible with your use case.


Let me know if this is usefull.


Regards,


Maël


Answer

Dear Steve,


Indeed this is a lot of strokes to process and we can't stop the recognition process when it's ongoing.


You probably should try to send only one recognition process at a time. This check should be done on your side.


Indeed, if a user open a notebook (you send all the strokes immediately), close it right after and open another notebook several times, the memory usage will be huge.

What you can do otherwise is to send the strokes only after a short delay (when you know the user will stay on this notebook page). But i don't know if this is possible with your use case.


Let me know if this is usefull.


Regards,


Maël

Dear Maël,

Thanks for the revert on our concern. We have the structure of a notebook with hundreds of pages, and each page has THOUSANDS of handwritten strokes. 

Here is our scenario to get the huge memory occupancy in our app.

=====================

Eg: Notebook-1 has 100 pages, assume each page has 1000 strokes 

- The user opened a notebook, we have started processing Page-1 strokes to recognize the text. it's occupying around 200-300MB.

- User closed the notebook before finishing the recognition process for Page-1. (Memory not yet released)

- The user opened one more book Notebook-2, then again recognition process continues and allocates 200MB (Total 500 MB)...

- Repeat this for 3-4 books, then our app will get crashed due to high memory allocation.

=====================

Thank you.

Can you please help us with a solution?


Thanks,

Steve

Dear Steve,


The additional memory consumption is likely linked to the recognition process itself. However, 1 GB seems a lot of memory.

If you can send us the ink with which you are testing, we could have a look to what is happening here.

For the time being, we have no way of canceling the ongoing recognition.


Regards,


Maël