-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate memory leak #2403
Comments
Thanks for that. Do you reproduce on Linux as well? |
Not yet, I was testing the Nugets first |
In your tests are you specifying an empty trie path and relying on the Scorer to create it dynamically? In other words, is |
No, I'm using a trie file path, let me see without it. |
Without the trie, it keeps in the range from 2GB to 4GB every run, without a noticeable difference in resource usage from the first one and the last one. |
So far I have a hard time reproducing the leak. @carlfm01 do you have specific code to share for reproducing ? amounts of memory leaked ? |
@carlfm01 Your previous message mentionned growing from 200MB to 700MB over 20 iterations, that would mean we are loosing 25MB per run. So far, I can only account for ~2MB at best:
And most of it is from TensorFlow itself, and this might be false-positive from valgrind. The only items that would connect to language model / decoder would account only for a few bytes (10 occurrences, between 24 bytes and 32 bytes, so at worst it's < 320 bytes per run). Obivously, very far away from what you experience. I do fear this might be Windows-specific. Or at least, not reproductible on Linux / under valgrind. |
Just the console example using a for over the same file::https://gist.github.com/carlfm01/fd69a8ca2784837dabf9375d35258953#file-test-cs-L59 Now I want to compile the console client for Linux to perform the same test, or that was exactly what you did? |
Finally compiled and now testing: Versions:
Valgrind report for 1 run:
20 runs:
Given the results looks you are correct. Now looking :kkm000/openfst#8 |
So it would mean |
Instead is using a custom implementation using a buffer: https://github.com/kkm000/openfst/blob/989affd3043b6357e6047a395565c3e0d979c01f/src/lib/mapped-file.cc#L48 I'll compile and debug that file, I also want to test a few things with https://code.google.com/archive/p/mman-win32/ and see if we can get rid of the buffer implementation. |
The destructor of DeepSpeech/native_client/ctcdecode/third_party/openfst-1.6.9-win/src/lib/mapped-file.cc Line 26 in 031479d
then never executes: DeepSpeech/native_client/ctcdecode/third_party/openfst-1.6.9-win/src/lib/mapped-file.cc Line 38 in 031479d
Before I found that the deconstructor is not called, I tried to replicate with the python client on windows and turns out that the python client does no contains |
It is handled by the wrapper: DeepSpeech/native_client/python/__init__.py Lines 42 to 45 in 031479d
|
Just to make sure, this is not only when using the Python code, this is always ? |
Yes always, with both, python client and the c# client. |
Can you replicate with the C++ basic client ? Just to see if the .Net bindings could have a play in the equation. |
|
yes I'll test the basic C++ client, allow me some time to complete my builds and switch back to r1.14 |
Dealing with |
Have you been able to sort this out? |
Hello @lissyx, unfortunately not, last week was a busy week working on TTS. I tried with short time windows but did not get any luck. I'm back to it :) |
Just realized I wasted my time, Bazel is not detecting changes inside header files :), manually removed the Bazel version: 0.24.1 At this point I don't know which changes were applied for the tests, testing again... :/ Now about the C++ basic client:
Yes, is eating the same amount of memory as the .Net client.
solved this by replacing : DeepSpeech/native_client/definitions.mk Line 39 in 5fa6d23
with my full path to the |
Right, reminds me of things I had to do on TaskCluster. I assumed that on developper systems, this should be already dealt with.
Good, at least confirms it's not coming from the bindings. Do you think you can investigate why the destructor is not called ? We have some code that triggers some lost but still reachable memory under valgrind on linux, and it deals with what calls this, so I'm wondering if this is not the root cause indeed, and we are just more lucky / going through another path on linux to free ? |
Yes, I'm already trying to spot the issue, but due to my newbie eyes for C++ I'm not making any significant progress. The only thing that seems wrong apart from the destructor of
Upper
¿What do you think? |
@carlfm01 Long-shot, but doing so does not seems to trigger issues here:
This should make sure that any |
i'm keeping that open until @carlfm01 can confirm this is fixed |
Thanks @lissyx Using : First run 53MB, last run 45MB.(.Net client) I can confirm that issue is fixed for the .Net client. Testing with Python and C++ client, looks like the C++ client is not releasing completely. |
I'm going to close it then, we can still fix the C++ client but if the leak in the lib is fixed it's the most important :) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
Memory not being released on model destroy when using the language model.
The issue is coming from
0.6.0-alpha.1
,0.6.0-alpha.0
works just fine.@lissyx the LAZY config change is not the source of the issue, lazy change: #2385
The text was updated successfully, but these errors were encountered: