Skip to content

Replace memoryPeak with actual process memory usage - #1062

Merged
Raltyro merged 4 commits into
CodenameCrew:mainfrom
HEIHUAa:process-memory
Aug 20, 2026
Merged

Replace memoryPeak with actual process memory usage#1062
Raltyro merged 4 commits into
CodenameCrew:mainfrom
HEIHUAa:process-memory

Conversation

@HEIHUAa

@HEIHUAa HEIHUAa commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Replace the second memoryPeak with the actual memory usage of the process as reported by the operating system. I believe this will be significantly more useful than the previous peak memory value. This works on Windows, macOS, and Linux. On non‑CPP targets or platforms other than these three, only a single memory number will be displayed, with the second one omitted.

@r6915ee

r6915ee commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

I think it may be useful to keep around an option to enable the peak memory value, as I've used it on occasion to determine memory usage issues in the case where a song might accidentally use too much memory and the current garbage-collected memory value changed too fast to get the actual value. Otherwise, I think this can also be useful.

@HEIHUAa

HEIHUAa commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

I think it may be useful to keep around an option to enable the peak memory value, as I've used it on occasion to determine memory usage issues in the case where a song might accidentally use too much memory and the current garbage-collected memory value changed too fast to get the actual value. Otherwise, I think this can also be useful.

Okay, I think your suggestion is fair. I'll add a setting to the debug options later. Personally, I've never really paid attention to the peak memory value — most of the time, it just gets frozen after a single large spike and stays there for a long time, which makes it pretty much useless except for very specific development needs. In most cases, it doesn't show anything meaningful.

@HEIHUAa

HEIHUAa commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

I added a setting item in the DEBUG OPTIONS menu, but I'm not sure if the naming is appropriate. It is now ready for review and commit.

@Raltyro

Raltyro commented Aug 19, 2026

Copy link
Copy Markdown
Member

i'm against with the linux implementation here? is there not a direct way to get the value?

@r6915ee

r6915ee commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

i'm against with the linux implementation here? is there not a direct way to get the value?

The other methods for getting the VmRSS value I know of seem to require root privileges.

That being said, I do think that implementation in specific could be changed to only update the value every now and then to avoid polling that file, as the file comes from the kernel.

@HEIHUAa

HEIHUAa commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

I think obtaining the RSS is the more correct method, and there doesn't seem to be any better alternative. I've added a throttle that only polls the kernel file once every 0.5 seconds.

If there's a better way, you're welcome to suggest it.

@Raltyro
Raltyro merged commit e208736 into CodenameCrew:main Aug 20, 2026
@HEIHUAa
HEIHUAa deleted the process-memory branch August 20, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants