Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Memory leak in Menu API #4860

@dnstufff

Description

@dnstufff

Steps to reproduce:

  1. Have a simple app that uses the Menu API. Just package.json and index.html:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript">
        var menu = new nw.Menu();
        menu.append(new nw.MenuItem({ label: 'Item A' }));
    </script>
</head>
<body >
</body>
</html>
  1. Start the app
  2. Take a heap snapshot from the dev tools (Profiling)
  3. Pick Containment from the drop down menu

Observation 1: 2 Window objects are present (Why not one but anyway)
image

  1. Make a location.reload() through the console multiple times
  2. Take another heap snapshot

Observation 2: Window objects have multiplied by as many times you've reloaded the app
image

Expected:
Since the menu variable is reinitialized on every load, the old one should be cleared by the GC

This bug is present in 0.12.3 and 0.14.5 and probably in all other versions in between

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions