Skip to content

Worker memory leak in android #1550

Closed
Closed
@simityx

Description

@simityx

Environment

  • CLI: 6.2.2
  • Cross-platform modules: 6.2.1
  • Android Runtime: 6.2.0
  • iOS Runtime: 6.2.0
  • Plugin(s): all default plugins from tns create, choosed vue, blank, after that add nativescript-dev-webpack

Describe the bug
In android, even worker terminated, the memory will not decrease.

To Reproduce

  1. Install any ram monitor to app to monitor simulator/phone memory or use any ways to monitor simulator/phone memory
  2. cd to testworker, type tns run android --bundle
  3. keep tapping the "Test Worker" button and monitor the simulator free memory.
  4. Below is the sample free memory before and after I tap 20 times button, I waited few minutes the free memory will not drop back to original even I not do any things.

Screenshot_1574872204
Screenshot_1574872235

Expected behavior
The app shall clear the memory used by the worker after worker closed or terminated.

Sample project

  1. tns create testworker, add worker loader plugin
  2. Choose vue, blank project
  3. Modify Home.vue in components/
    3.1. add a button
    <Button @tap="newworker" text="Test Worker" />
    3.2. Import worker
    import * as TestWorker from 'nativescript-worker-loader!~/test-worker';
    3.3. Add new methods named newworker, code inside put
var worker = new TestWorker();
worker.postMessage('Testing');
worker.onmessage = function(msg)
{
console.log(msg);
worker.terminate();
 }
  1. Create worker named test-worker inside app/, put
require("tns-core-modules/globals");

global.onmessage = function (data)
{
    global.postMessage(data);
}
  1. tns run android --bundle

Additional context

  • Android Platform, Android Build Tools both are 29, tested with 28 also
  • Simulator is using Google APIs Intel x86 Atom System Image (28)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions