Open humpalum opened 1 year ago
Hey yall,
I think i found a memory leak in the CodeMirror Component...
You can find the PoC in the following Codesandbox:
CAREFUL: It will fill up your memory in just few minutes... I used a quite small interval as well as many CodeMirror to speed up the process...
https://codesandbox.io/s/gallant-danilo-nc8euu?file=/src/App.js
Memory usage: ~1 min later:
It seems like Firefox is more affected by this than Chrome.. Chromes memory fills up way slower...
The workaround that i use is the following: Instead of:
<CodeMirror theme={theme.colorScheme} height="500px" value={originalFilters} //defaultValue={originalFilters} placeholder={placeholder} onChange={setCurrentFilters} readOnly={readOnly} />
I use a memo:
<CodeMirrorMemo theme={theme.colorScheme} height="500px" value={originalFilters} //defaultValue={originalFilters} placeholder={placeholder} onChange={setCurrentFilters} readOnly={readOnly} /> const CodeMirrorMemo = memo(CodeMirror)
I'm not sure what else i could provide right now but feel free to request whatever else i can provide to help out. Thank you :)
Might be related to https://github.com/codemirror/dev/issues/1070 ?
@humpalum I can't solve this problem. If there is any optimization direction in the future, please let me know.
Hey yall,
I think i found a memory leak in the CodeMirror Component...
You can find the PoC in the following Codesandbox:
CAREFUL: It will fill up your memory in just few minutes... I used a quite small interval as well as many CodeMirror to speed up the process...
https://codesandbox.io/s/gallant-danilo-nc8euu?file=/src/App.js
Memory usage: ~1 min later:
It seems like Firefox is more affected by this than Chrome.. Chromes memory fills up way slower...
The workaround that i use is the following: Instead of:
I use a memo:
I'm not sure what else i could provide right now but feel free to request whatever else i can provide to help out. Thank you :)