[Bug] Memory Leak in UsageMonitor... or Windows PerfMon?

Report bugs with the Rainmeter application and suggest features.
User avatar

[Bug] Memory Leak in UsageMonitor... or Windows PerfMon?

May 24th, 2018, 11:39 pm
SilverAzide
   [482 posts]

Hello!

I hesitate to post this since 99% of the time these sorts of posts are baseless, but there seems to be a memory leak someplace. Unfortunately, I don't have a good way to point a developer at a particular point in the code, but I'm happy to help in any way that I can.

Typically when I run Rainmeter with my usual set of skins active, Rainmeter consumes roughly 35MB of RAM, and this remains very steady. However, when I add a skin that has many instances of UsageMonitor measures (a "top process" skin), the Rainmeter process slowly consumes memory. After about 8 hours, memory is about 70MB and slowly increasing. I have not had time to let this run for a very long time under different conditions, but at one point I did let Rainmeter run this skin continuously for 3 days; at that point RM was using several hundred megabytes of RAM and -- unfortunately at some point while I was not looking -- RM seems to have crashed or something, because it was completely gone (no error message). So I was not able to see any message or attach a debugger. I have not had time to try duplicating this, but the memory issue is easily replicated.

I know this info is probably of little help. In case it matters, this is happening on multiple machines, including a "clean" VirtualBox VM with nothing on it except Rainmeter.

4.2.0 beta r3064 64-bit (May 13 2018) - English (1033)
Windows 10 Pro 1803 64-bit (build 17134) - English (1033)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\xxx\Documents\Rainmeter\Skins\
SettingsPath: C:\Users\xxx\AppData\Roaming\Rainmeter\
IniFile: C:\Users\xxx\AppData\Roaming\Rainmeter\Rainmeter.ini

Finally, if it is of any value, I've attached the skin demonstrating the issue. I don't think this skin is doing anything too abnormal, no extra plugins or etc., but perhaps I'm doing something that is causing an issue.
You do not have the required permissions to view the files attached to this post.
DeviantArt Gadgets More...
User avatar

Re: [Bug] Memory Leak in UsageMonitor... or Windows PerfMon?

May 25th, 2018, 11:12 pm
tjhrulz
Developer   [221 posts]

I'll investigate this tonight, likely some thread is not terminating correctly.

Is the thread count going up over time?

Edit: I have replicated the memory leak on my machine, also the thread count did slightly increase but the memory did not grow in bursts though. No idea why that would be happening though so I use timer threads for everything and all locks are being properly freed, also VS tried to tell me my heap space was only 1.7MB which isn't even right normally.

Status: Confirmed, further investigation needed to find cause.
Last edited by tjhrulz on May 26th, 2018, 3:48 pm, edited 3 times in total.
User avatar

Re: [Bug] Memory Leak in UsageMonitor... or Windows PerfMon?

May 26th, 2018, 1:31 am
SilverAzide
   [482 posts]

tjhrulz wrote:I'll investigate this tonight, likely some thread is not terminating correctly.

Is the thread count going up over time?

I did not think to check that! I'll check it out also and let you know.

Update:
tjhrulz wrote:Status: Confirmed, further investigation needed to find cause.

Glad to hear you were able to replicate this! I did check the thread count per your suggestion. This isn't an extensive run, but:
At session start, Rainmeter was at 25 threads and 36 MB of RAM.
After 4 hours, 28 threads and 48 MB RAM.
After 7 hours, 30 threads and 56 MB RAM.
PC was fairly idle during this time, only light browsing and email. I tried not to touch anything in Rainmeter to make the instance as static as possible.
DeviantArt Gadgets More...
User avatar

Re: [Bug] Memory Leak in UsageMonitor... or Windows PerfMon?

May 31st, 2018, 9:59 pm
tjhrulz
Developer   [221 posts]

SilverAzide wrote:I did not think to check that! I'll check it out also and let you know.

Update:

Glad to hear you were able to replicate this! I did check the thread count per your suggestion. This isn't an extensive run, but:
At session start, Rainmeter was at 25 threads and 36 MB of RAM.
After 4 hours, 28 threads and 48 MB RAM.
After 7 hours, 30 threads and 56 MB RAM.
PC was fairly idle during this time, only light browsing and email. I tried not to touch anything in Rainmeter to make the instance as static as possible.


Lol the threads had nothing to do with it, since Marshal.StringToHGlobalUni allocates memory that must be manually freed and I never used a buffer for it every measures GetString would leak a very tiny amount of memory. :x


brb gonna go fix a memory leak I have in one of my other plugins now...

Return to “Bugs & Feature Suggestions”



Who is online

Users browsing this forum: CommonCrawler [Bot] and 0 guests