Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excess ram usage after listing files. #395

Open
MarkWolves opened this issue Aug 19, 2023 · 3 comments
Open

Excess ram usage after listing files. #395

MarkWolves opened this issue Aug 19, 2023 · 3 comments
Assignees
Labels
Milestone

Comments

@MarkWolves
Copy link

By pressing F5 several times you can notice a non-returning increase in ram usage. The bug occurs in explorer. My Windows is 7 (updated since 2015-2023 - avoiding not using Windows 10).

@GerbilSoft
Copy link
Owner

I did manage to reproduce this on my Windows 7 VM, but I'm not sure what's causing it. MSVC doesn't seem to have as many useful memory leak tools as Linux environments (valgrind, heaptrack, etc).

I tried out MSVCRT's built-in memory allocation reporting, and it did find one leak in AesCAPI_NG (only used when handling files that have encryption).

https://learn.microsoft.com/en-us/cpp/c-runtime-library/find-memory-leaks-using-the-crt-library?view=msvc-170

I suspect that if the other leaks are in fact caused by rom-properties and aren't weird caching behavior in Explorer, it's likely a Windows resource leak and not something that can be detected by MSVCRT. Will look for resource leak tools next.

@GerbilSoft GerbilSoft self-assigned this Aug 19, 2023
@GerbilSoft GerbilSoft added the bug label Aug 19, 2023
@GerbilSoft GerbilSoft added this to the 2.3 milestone Aug 19, 2023
@GerbilSoft
Copy link
Owner

Found something using WinDbg's !htrace command.

https://ofekshilon.com/2014/07/08/debugging-handle-leaks/

Will post results once I'm done analyzing it.

@GerbilSoft
Copy link
Owner

...and it seems I've hit a roadblock. What I thought were leaks was actually WinDbg logging both file open and close. Tried another tool and it showed many known memory leaks in Windows components, but nothing in rom-properties.

I suspect it might be a problem with IExtractIcon using up too much memory, since Explorer isn't really designed for per-file icons. Disabling IExtractIcon will still allow for thumbnail previews. I'll look into doing this in rp-config and seeing if it helps with this problem.

GerbilSoft added a commit that referenced this issue Aug 19, 2023
AesCAPI_NG leaks this in the destructor because it doesn't even attempt
to free(pbKeyObject).

Found while debugging #395: Excess ram usage after listing files.
Reported by @MarkWolves.
GerbilSoft added a commit that referenced this issue Aug 19, 2023
…en if it wasn't opened.

Otherwise, we end up leaking the RpFile.

See issue #395: Excess ram usage after listing files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants