Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRunnable memory leak #1544
Runnable memory leak #1544
Comments
|
turns out this was because the Runnable was calling a callback with a |
|
@patricklx, could you please attach a sample project illustrating the issue? Also did you get a chance to test with |
|
Hi @darind In this example you will be able to see that StringBuilder is leaking, so never released. https://github.com/patricklx/ns-memory-leak |
|
@patricklx, thanks for the sample project. This is indeed a bug with const Test = my.Test.Test.extend({
invoke(arg) {
const val = arg.toString();
console.log('invoked', val.length);
// Manually release the native memory retained by the parameters:
__releaseNativeCounterpart(arg);
}
}); |
|
thanks, I already found that workaround. But it also does not release all other native object allocations in that callback... So, for every native function that returns a new object |
|
We are not planning on making changes to the |
Environment
Provide version numbers for the following components (information can be retrieved by running
tns infoin your project folder or by inspecting thepackage.jsonof the project):Describe the bug
We noticed the memory increasing in our app, which is when we started to investigate memory leaks.
We noticed in Android Studio Profiler that
Runnableis never deallocated and this also happens forNativeScriptHashMap.HashMapEntryMost entries happen when
Is it possible that
com.tns.gen.java.lang.Runnableis overridingjava.lang.Runnable? Since I'm expecting to seejava.lang.Runnable, but I only seecom.tns.gen.java.lang.Runnable