Skip to content

Conversation

@ilovelinabell
Copy link
Contributor

What does this PR do?

Further improves memory utilization by making the Go garbage collector trigger more frequently. By requiring that the GC trigger each time after Zen allocates a new 5% of memory, we can keep the actual memory used (what Task Manager or Resource Monitor sees) close to the amount of memory Zen actually requires.

How did you verify your code works?

At startup, usage is ~350 to 360 MB. This is about 40-60 MB less than before. The startup time of Zen seems relatively the same, and the browsing/web performance seems unaffected on YT.

What are the relevant issues?

Closes #221

@ilovelinabell
Copy link
Contributor Author

@anfragment Review for you

@anfragment
Copy link
Member

@ilovelinabell Thank you for the PR, and apologies for the delayed response.

I'm currently working on a broader rework of the trie to reduce memory usage, and I'd like to revisit this once that's in place. I'm not entirely sure about setting the GC percentage to 5 (it may introduce some CPU overhead if we're not careful with benchmarking), but at the same time, the default value of 100 doesn't feel reasonable for a desktop application either.

In any case, please be assured that this PR is still on my radar.

@anfragment
Copy link
Member

For future reference:
https://pkg.go.dev/runtime/debug#SetGCPercent

@anfragment anfragment added the hold Temporarily freezed label Sep 23, 2025
@ZenPrivacy ZenPrivacy deleted a comment from MaybeHoot Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Temporarily freezed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The memory usage is too high, about the same as that of browsers and online games

2 participants