Skip to content

force update #222

@ripienaar

Description

@ripienaar

I used g.Update to append lines to a text box that scrolls - like a tail -f.

Periodically i remove lines from buffer so the size doesnt grow forever, however the fact that g.Update() creates a go routine leaks lots of memory over time. After a few 10k lines you end up with 10k go routines worth of descriptors in memory that will never be freed.

Editing the code and changing update to:

func (g *Gui) Update(f func(*Gui) error) {
	g.userEvents <- userEvent{f: f}
}

improves things for me drastically without impacting anything noticable. Can you perhaps tell me the reason why Update does this in a go routine? Might we add a SyncUpdate or similar that doesnt create a go routine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions