editor icon indicating copy to clipboard operation
editor copied to clipboard

Memory usage explosion when searching in all files

Open rafern opened this issue 2 years ago • 6 comments

Description

When searching in all files, memory usage sometimes increases to huge amounts. Maybe its searching files that it shouldn't? If this happens, the search will also freeze.

https://user-images.githubusercontent.com/15365765/174808920-96d51325-b31d-41a5-a42c-a6777275e374.mp4

Steps to Reproduce

  1. Open the code editor
  2. Search for something in the Find in files tab (ctrl+shift+f)
  3. Memory usage explodes and the search freezes

rafern avatar Jun 21 '22 13:06 rafern

Duplicate of https://github.com/playcanvas/editor/issues/720 possibly?

In that gif, not sure where upper is used (is it in a large JSON file?).

The short term workaround is to use find in files filters to reduce the scope/exclude certain files from search:

https://twitter.com/dejohn_paul/status/1523696485254451202

yaustar avatar Jun 21 '22 13:06 yaustar

@yaustar This is using the search for all files in the project, so I'm not sure which of them is causing the issue. There are JSON files, glb models, textures, code etc... But the problem only started recently after adding more models to the project. Maybe that's what's causing the issue?

rafern avatar Jun 21 '22 13:06 rafern

Never mind, GLB files aren't searchable in the editor. I tried your suggestion and filtered by file type. Large (~7MB, ~9MB and ~14MB) JSON files were causing the issue, but its still weird that searching those files were causing a memory usage of +16GB

rafern avatar Jun 21 '22 13:06 rafern

It's definitely something we should investigate, hopefully the find in files will mitigate it a bit in the meantime 🤞

yaustar avatar Jun 21 '22 13:06 yaustar

@slimbuck Would this be fixed by your changes that made find in files much faster?

yaustar avatar Aug 31 '22 08:08 yaustar

Possibly. Worth checking.

slimbuck avatar Aug 31 '22 14:08 slimbuck

Assumed fixed with slimbuck's changes to faster search

yaustar avatar Feb 08 '23 16:02 yaustar