giu: [bug] codeeditor memory consumption

What happend?

Tried to make a tab system using multiple editors works fine!

The issue comes when you out in alot of text into these editors. If i out in around 13k lines, I can watch as my memory usage slowly increases into the 10s of gbs

Code example

main.go
// put your code here!

To Reproduce

  1. Run my demo
  2. will see the crash…

Version

master

OS

Windows 11

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

again, on the demo you sent me, it has 0 problems rendering and displaying this text, and it also doesnt slow down the applications fps (if i have this amt of text in the golang version, dragging is slow. on the normal c++ demo you sent me, it handles it perfectly, no memory increases nor fps drops)

again, unsure whats causing this exactly. but im glad i can help out a little

A possibility for the memory increases could also be the stringMap in the fontatlas. You’re also rebuilding the font atlas every frame which could be causing slow downs.

This would increase CPU usage but not memory because the map is cleared every frame (and generally is managed by go so GC is here). btw @AllenDang what do you think about reworking FontAtlas a bit? I think there should be a possibility to disable auto registration for strings (because iterating over 13k lines of code could be a bit heavy) and rather allow user register characters once.

ive tried out scex.exe, it doesnt have the issue. so its most likely a giu problem ;w;

I’d rather say cimgui-go problem 😉 but yes its deffinitly something in our wrapper.

I’ve checked and ImGuiColorTextEdit.CodeEditor.Text() is a problem.

It’s reasonable to provide a mechanism to disable auto string registration, it will increase the complexity but provides possibility for some corner case like this.

A possibility for the memory increases could also be the stringMap in the fontatlas.

You’re also rebuilding the font atlas every frame which could be causing slow downs.

This would increase CPU usage but not memory because the map is cleared every frame (and generally is managed by go so GC is here). btw @AllenDang what do you think about reworking FontAtlas a bit? I think there should be a possibility to disable auto registration for strings (because iterating over 13k lines of code could be a bit heavy) and rather allow user register characters once.

ive tried out scex.exe, it doesnt have the issue. so its most likely a giu problem ;w;

I’d rather say cimgui-go problem 😉 but yes its deffinitly something in our wrapper.

I’ve checked and ImGuiColorTextEdit.CodeEditor.Text() is a problem.

leak in our string conversion? 🤔 could be possible. Could you try with C++ demo from https://github.com/BalazsJako/ImGuiColorTextEdit

Of course, I can try it when I get home ^^