hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Windows 10 Memory leak 3.1.0-canary.5

Open skm7463 opened this issue 5 years ago • 6 comments

  • [x ] Hyper.app version 3.1.0-canary.5
  • [x ] Issue is reproducible

Issue

Windows 10 memory leak when creating new panes or tab then closing the new pane or tab.

I have created a simple local plugin to demonstrate the issue.

Insert the test plugin, run Hyper then monitor the memory using any memory tool such as Windows Resource Monitor.

Insert into .hyper.js...

localPlugins: ["memtest"],

And add index.js to .hyper_plugins/local/memtest....

index.js....

const electron = require('electron'); const { ipcMain } = require('electron'); const {ipcRenderer} = require('electron');

let started = false; let myWin = null; let activeSession = null; let numSessions = 0; let toggle = false;

function processStart(event, session) { activeSession = session;

setTimeout(function () { myWin.rpc.emit('split request horizontal', {}); }, 10);

}

function processAdd(event, session) { activeSession = session;

setTimeout(function () { myWin.rpc.emit('termgroup close req', { uid: activeSession }); }, 50); }

function processExit(event, session) { activeSession = session;

setTimeout(function () { myWin.rpc.emit('split request horizontal', {}); }, 50);

}

exports.onWindow = (win) => { myWin = win; ipcMain.on("memtest-start", function (event, session) { processStart(event, session) }); ipcMain.on("memtest-add", function (event, session) { processAdd(event, session) }); ipcMain.on("memtest-exit", function (event, session) { processExit(event, session) }); }

exports.middleware = store => next => action => {

if (store) activeSession = store.getState().termGroups.activeSessions[store.getState().termGroups.activeRootGroup];

switch (action.type) { case 'SESSION_ADD':

  if (!started)
  {
     started = true;

     setTimeout(function () { ipcRenderer.send("memtest-start", activeSession); }, 10);
  }
  else
  {
     if (store)
     {
        setTimeout(function () { ipcRenderer.send("memtest-add", activeSession); }, 10);
     }
  }

  break;

case 'SESSION_USER_EXIT': if (started) { setTimeout(function () { ipcRenderer.send("memtest-exit", activeSession); }, 10); } break; }

next(action); }


  • Hyper version: undefined "3.1.0-canary.5"
  • OS ARCH VERSION: win32 x64 10.0.19042
  • Electron: 13.0.1 LANG: undefined
  • SHELL: undefined TERM: undefined
.hyper.js contents
{
  "useConpty": false,
  "updateChannel": "canary",
  "scrollback": 80,
  "fontSize": 15,
  "fontFamily": "Consolas",
  "fontWeight": "normal",
  "fontWeightBold": "bold",
  "lineHeight": 1,
  "letterSpacing": 0,
  "cursorColor": "rgba(248,28,229,0.8)",
  "cursorAccentColor": "#000",
  "cursorShape": "BLOCK",
  "cursorBlink": true,
  "foregroundColor": "#bbb",
  "backgroundColor": "#000",
  "selectionColor": "rgba(199,199,199,0.5)",
  "borderColor": "#404040",
  "css": "",
  "termCSS": "",
  "showHamburgerMenu": "true",
  "showWindowControls": "true",
  "padding": "8px 10px",
  "colors": {
    "black": "#000000",
    "red": "#C51E14",
    "green": "#1DC121",
    "yellow": "#C7C329",
    "blue": "#0A2FC4",
    "magenta": "#C839C5",
    "cyan": "#20C5C6",
    "white": "#C7C7C7",
    "lightBlack": "#686868",
    "lightRed": "#FD6F6B",
    "lightGreen": "#67F86F",
    "lightYellow": "#FFFA72",
    "lightBlue": "#6A76FB",
    "lightMagenta": "#FD7CFC",
    "lightCyan": "#68FDFE",
    "lightWhite": "#FFFFFF"
  },
  "env": {},
  "bell": "SOUND",
  "copyOnSelect": true,
  "defaultSSHApp": true,
  "quickEdit": false,
  "macOptionSelectionMode": "vertical",
  "webGLRenderer": true,
  "hyperBorder": {
    "borderColors": [
      "#67CBFF",
      "#67CBFF"
    ],
    "blurredColors": [
      "#404040",
      "#404040"
    ],
    "borderWidth": "1px"
  },
  "hyperTabsMove": {
    "moveLeft": "ctrl+[",
    "moveRight": "ctrl+]"
  }
}
plugins
{
  "plugins": [
    "hyper-search",
    "hyperborder",
    "hypercwd"
  ],
  "localPlugins": [
    "xplugin"
  ]
}

skm7463 avatar Jun 03 '21 13:06 skm7463

probably https://github.com/electron/electron/issues/29292

Stanzilla avatar Jun 04 '21 20:06 Stanzilla

Thanks Stanzilla, however the issue is considerably worse in canary.5 than in 3.0.2. There is a smaller leak in 3.0.2 but this is many more MB's per refresh.

I noticed it first in canary.4 though I maybe mistaken that it looks like a new issue, probably worthy of further investigation.

skm7463 avatar Jun 05 '21 00:06 skm7463

3.0.2 is years old and does not have the Electron version this issue is from

Stanzilla avatar Jun 05 '21 00:06 Stanzilla

Ah OK. Thanks

skm7463 avatar Jun 05 '21 01:06 skm7463

@skm7463 try the latest build https://nightly.link/vercel/hyper/workflows/nodejs/canary

LabhanshAgrawal avatar Jun 06 '21 03:06 LabhanshAgrawal

Hi Labhansh, just rested and unfortunately the leak is still there. I confirmed with was with electron 13.1.1. "node": "14.16.0", "v8": "9.1.269.28-electron.0", "zlib": "1.2.11", "brotli": "1.0.9", "ares": "1.16.1", "modules": "89", "nghttp2": "1.41.0", "napi": "7", "llhttp": "2.1.3", "openssl": "1.1.1", "icu": "68.1", "unicode": "13.0", "electron": "13.1.1", "chrome": "91.0.4472.77"

skm7463 avatar Jun 08 '21 11:06 skm7463