eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.46k stars 2.46k forks source link

Terminal is leaking #4894

Open AlexTugarev opened 5 years ago

AlexTugarev commented 5 years ago

Open 4 Terminal widgets. Close them. Take a heap snapshot:

Screen Shot 2019-04-12 at 14 46 56

Repeat with 3 more widgets (just in case)

Screen Shot 2019-04-12 at 14 47 56

Then open 2 other terminals and create some output, e.g. cat yarn.lock or top. Compare the retainers by size with a previous snapshot.

Screen Shot 2019-04-12 at 14 50 06 Screen Shot 2019-04-12 at 14 50 09

This is pretty bad: the ArrayBuffers from xterm remain in memory.

AlexTugarev commented 5 years ago

BTW this was the original hint to this issue:

root WARN Error: Possible Emitter memory leak detected. 30 exit listeners added. Use event.maxListeners to increase limit
    at Emitter.../../packages/core/lib/common/event.js.Emitter.checkMaxListeners (http://localhost:3000/bundle.js:98360:26)
    at PreferenceServiceImpl._event.Object.assign.maxListeners [as onPreferenceChanged] (http://localhost:3000/bundle.js:98327:27)
    at Object.createPreferenceProxy (http://localhost:3000/bundle.js:84292:32)
    at createTerminalPreferences (http://localhost:3000/32.bundle.js:139:22)
    at Binding.dynamicValue (http://localhost:3000/32.bundle.js:145:16)
    at http://localhost:3000/bundle.js:35993:118
    at invokeFactory (http://localhost:3000/bundle.js:35940:16)
    at http://localhost:3000/bundle.js:35993:26
    at Array.map (<anonymous>)
    at _injectProperties (http://localhost:3000/bundle.js:35879:57)
akosyakov commented 5 years ago

@AlexTugarev Can you reproduce with latest xtermjs? Which code retains ArrayBuffers? xtermjs?