Closed us3r64 closed 8 years ago
Ouch, that definitely looks worse than it should. I'm trying to reproduce and can't get it higher than around 230mb. I'll have to find a good valgrind-like tool for Go..
Some questions to reproduce in case I need to track it down manually:
I don't think it's a memory leak. What I'm seeing with smaller files is that when I move around it takes a few renders (and j,k is triggering the render code since it needs to move where the cursor is drawn) before the Go GC kicks in.
I'm afraid to ask what you're doing with 76kb of source code in a single file (the biggest one in de is ~3kb), but I think writing the text in it to an RGBA image that can be drawn on the window is so large means that 5-6x that is getting out of hand and (and probably swapping before the GC has a chance to kick in?)
What I'll have to do is make sure the rendering code is smart enough to only render the part of the file that's being drawn to the screen so that it's invariant of file size, which is something I've been meaning to do anyways, but with my smaller files it's been fast enough to not be a significant issue.
Is the code that you're viewing open source or available somewhere that I can use as a test case?
Same issue. Looks that with file size memory used grows exponentially.
I just commited something that should fix this. Can you try it and let me know if it worked?
The speed of the rendering (and responsiveness of the keyboard as a result) is still proportional to the file size, but now it's only allocating an image the size of the window, so the memory usage should be constant (or at least a function of the window size instead of the file size..)
Same behavior using the main.go file from @Komosa
@us3r64 Did you update to the latest code? The excess memory consumption should be fixed in the latest version if you update with go get -u github.com/driusan/de
, but yes, @Komosa's linked is big enough to have broken with the old version.
Looks to be fixed now.
it looks like you have some memory leaks in there: