• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Running out of RAM

Joined
Jul 25, 2006
Messages
13,179 (1.97/day)
Location
Nebraska, USA
System Name Brightworks Systems BWS-6 E-IV
Processor Intel Core i5-6600 @ 3.9GHz
Motherboard Gigabyte GA-Z170-HD3 Rev 1.0
Cooling Quality case, 2 x Fractal Design 140mm fans, stock CPU HSF
Memory 32GB (4 x 8GB) DDR4 3000 Corsair Vengeance
Video Card(s) EVGA GEForce GTX 1050Ti 4Gb GDDR5
Storage Samsung 850 Pro 256GB SSD, Samsung 860 Evo 500GB SSD
Display(s) Samsung S24E650BW LED x 2
Case Fractal Design Define R4
Power Supply EVGA Supernova 550W G2 Gold
Mouse Logitech M190
Keyboard Microsoft Wireless Comfort 5050
Software W10 Pro 64-bit
Sorry, TheinsanegamerN but you just underlined the Princess's and my point. You just demonstrated you don't fully understand commit rates or commit limits.

That is NOT a criticism. Just an observation.

Are you a true expert in memory management? Are you a computer scientist? Note I did not ask if you are a programmer or even a hardware tech.

Why is such a commit limit in place? MS requires you to either sacrifice notable storage space just to use your RAM, or face annoying errors like this.
Why is a commit limit in place? Why does the room you are standing in limit the size of the furniture you put in it?

Commit limit = the current page file size + RAM amount. How is Microsoft forcing that limit on you?

And nothing requires you sacrifice your storage space to use your RAM. Total nonsense.

I can use 99% of my system RAM with no swap and no errors.
Yeah. So? That proves nothing.

I left my front door unlocked last night and no one came in. That means it is safe to leave my door unlocked, right? :kookoo:

but why is there no option to get around this?
Huh? Again, you just demonstrated you really don't understand how it works in Windows and you should go with the defaults. Again, not a criticism - just another observation.
 
Joined
Dec 28, 2012
Messages
3,896 (0.89/day)
System Name Skunkworks 3.0
Processor 5800x3d
Motherboard x570 unify
Cooling Noctua NH-U12A
Memory 32GB 3600 mhz
Video Card(s) asrock 6800xt challenger D
Storage Sabarent rocket 4.0 2TB, MX 500 2TB
Display(s) Asus 1440p144 27"
Case Old arse cooler master 932
Power Supply Corsair 1200w platinum
Mouse *squeak*
Keyboard Some old office thing
Software Manjaro
Sorry, TheinsanegamerN but you just underlined the Princess's and my point. You just demonstrated you don't fully understand commit rates or commit limits.

That is NOT a criticism. Just an observation.

Are you a true expert in memory management? Are you a computer scientist? Note I did not ask if you are a programmer or even a hardware tech.
No, I am not
Why is a commit limit in place? Why does the room you are standing in limit the size of the furniture you put in it?
Right. But if your room has space for 2 chairs and a table, but refuses entrence if you put mroe then a table into the room, THAT doesnt make any sense. That's what MS's commit limit is doing.
Commit limit = the current page file size + RAM amount. How is Microsoft forcing that limit on you?
The Princess demostrated a situation where, with no Swap available, the system was acting like it was out of memory when there was demonstrably plenty of physical RAM not being used. MS forces you to have a page file large enough to hold a hypothetical commit larger then what you are actually using to use your phsyical RAM. This is silly.
And nothing requires you sacrifice your storage space to use your RAM. Total nonsense.
Space slated for swap usage cannot be used to store files. If your swap is not large enough, even if you are not using said swap, windows will not use all your available phsyical RAM. This, demonstrably, requires you to sacrifice storage to use RAM in windows.
Yeah. So? That proves nothing.
It proves that requiring commits larger thent he amount of RAM you are using is unnecessary.
I left my front door unlocked last night and no one came in. That means it is safe to leave my door unlocked, right? :kookoo:
No, but it demonstrates that your risk may be lower then the standard, and if you know what you are doing/are aware of the risks/have your reasons, you dont need Microsoft Door Manager refusing to turn off the lights because your door is unlocked.
Huh? Again, you just demonstrated you really don't understand how it works in Windows and you should go with the defaults. Again, not a criticism - just another observation.
I dont use windows, I use linux. And I dont have these issues.
 
  • Like
Reactions: SL2
Joined
Jul 25, 2006
Messages
13,179 (1.97/day)
Location
Nebraska, USA
System Name Brightworks Systems BWS-6 E-IV
Processor Intel Core i5-6600 @ 3.9GHz
Motherboard Gigabyte GA-Z170-HD3 Rev 1.0
Cooling Quality case, 2 x Fractal Design 140mm fans, stock CPU HSF
Memory 32GB (4 x 8GB) DDR4 3000 Corsair Vengeance
Video Card(s) EVGA GEForce GTX 1050Ti 4Gb GDDR5
Storage Samsung 850 Pro 256GB SSD, Samsung 860 Evo 500GB SSD
Display(s) Samsung S24E650BW LED x 2
Case Fractal Design Define R4
Power Supply EVGA Supernova 550W G2 Gold
Mouse Logitech M190
Keyboard Microsoft Wireless Comfort 5050
Software W10 Pro 64-bit
I dont use windows, I use linux. And I dont have these issues.
LOL I don't use Linux (anymore). I use Windows. And I don't have these issues.

Moving on.
 
  • Haha
Reactions: SL2
Joined
Aug 20, 2007
Messages
21,476 (3.40/day)
System Name Pioneer
Processor Ryzen R9 9950X
Motherboard GIGABYTE Aorus Elite X670 AX
Cooling Noctua NH-D15 + A whole lotta Sunon and Corsair Maglev blower fans...
Memory 64GB (4x 16GB) G.Skill Flare X5 @ DDR5-6000 CL30
Video Card(s) XFX RX 7900 XTX Speedster Merc 310
Storage Intel 905p Optane 960GB boot, +2x Crucial P5 Plus 2TB PCIe 4.0 NVMe SSDs
Display(s) 55" LG 55" B9 OLED 4K Display
Case Thermaltake Core X31
Audio Device(s) TOSLINK->Schiit Modi MB->Asgard 2 DAC Amp->AKG Pro K712 Headphones or HDMI->B9 OLED
Power Supply FSP Hydro Ti Pro 850W
Mouse Logitech G305 Lightspeed Wireless
Keyboard WASD Code v3 with Cherry Green keyswitches + PBT DS keycaps
Software Gentoo Linux x64 / Windows 11 Enterprise IoT 2024
I've installed more than a hundred times ever since W2000, and many times I've done it directly without trying to figure out what's going on, but in the end it always depends on what's wrong.

This time it was different. It pretty much always takes three days before it goes wrong, and I just got too curious to let it go.

Can anyone guess why this code would cause memory leaks in Windows, but only after three days? I'm no expert.. :D The program itself never uses more than 4 MB.

View attachment 323638
I can tell you similar programs exist that do what you are doing without reinventing the wheel.

Look into something like below:

 
  • Like
Reactions: SL2

Mussels

Freshwater Moderator
Joined
Oct 6, 2004
Messages
58,413 (7.94/day)
Location
Oystralia
System Name Rainbow Sparkles (Power efficient, <350W gaming load)
Processor Ryzen R7 5800x3D (Undervolted, 4.45GHz all core)
Motherboard Asus x570-F (BIOS Modded)
Cooling Alphacool Apex UV - Alphacool Eisblock XPX Aurora + EK Quantum ARGB 3090 w/ active backplate
Memory 2x32GB DDR4 3600 Corsair Vengeance RGB @3866 C18-22-22-22-42 TRFC704 (1.4V Hynix MJR - SoC 1.15V)
Video Card(s) Galax RTX 3090 SG 24GB: Underclocked to 1700Mhz 0.750v (375W down to 250W))
Storage 2TB WD SN850 NVME + 1TB Sasmsung 970 Pro NVME + 1TB Intel 6000P NVME USB 3.2
Display(s) Phillips 32 32M1N5800A (4k144), LG 32" (4K60) | Gigabyte G32QC (2k165) | Phillips 328m6fjrmb (2K144)
Case Fractal Design R6
Audio Device(s) Logitech G560 | Corsair Void pro RGB |Blue Yeti mic
Power Supply Fractal Ion+ 2 860W (Platinum) (This thing is God-tier. Silent and TINY)
Mouse Logitech G Pro wireless + Steelseries Prisma XL
Keyboard Razer Huntsman TE ( Sexy white keycaps)
VR HMD Oculus Rift S + Quest 2
Software Windows 11 pro x64 (Yes, it's genuinely a good OS) OpenRGB - ditch the branded bloatware!
Benchmark Scores Nyooom.
The memory chugging kicked in today, I checked with poolmon and figured it out. I have the same problem as this one.

When looking for info I saw a lot of dead ends, people who never could figure it out. Here I saw some more info about what to do, although I never got to try it myself.

The cause for this was a small program I made that runs in the background (audio related). I will have a look at it later on, but I'm glad I didn't reinstall! That would have been a waste of time.

I disabled some Startup Event Trace Sessions earlier, do they have to be reactivated?


Thanks everyone for the help!
These massive memory leaks occured for me when using any active microphone and i had Nvbroadcast installed, from any source (the official nvidia app, Icue, LGhub, etc)
Uninstalling those programs did not remove their NV Broadcast addons, and they each used 1GB+ of RAM.

what was this audio program intended to do?
 

SL2

Joined
Jan 27, 2006
Messages
2,454 (0.36/day)
Play a soundfile (silence) every tenth second.

I can tell you similar programs exist that do what you are doing without reinventing the wheel.

Look into something like below:

I didn't try to invent anything, just solving a simple problem on my own. Now I keep on working with it just to learn from it.

Thanks for the tip.


If anyone interprets my posts as me bragging about what I've accomplished, well that's not what's going on. I mean, it's like two lines of code lol..
I just wanted some help, and I'm thankful for all the help I've been getting
 
Joined
Jan 1, 2012
Messages
344 (0.07/day)
Your rant is appreciated, but it also underlines why so many think they can outdo MS. Why is such a commit limit in place? MS requires you to either sacrifice notable storage space just to use your RAM, or face annoying errors like this. Linux doesnt ahve this issue, and neither did MACos back when you could upgrade. I can use 99% of my system RAM with no swap and no errors. Of course, that should be the default for msot users, but why is there no option to get around this?

It's also brining back bad memories of XP and it's LOVE of swapping as much as possible to pagefile. I do remember making RAMdisks with excess sytem RAM and forcing the pagfile onto them to get around this, but it was something just dumb....
I'm not a memory management expert, so I'll defer to those who are, but to my limited understanding, when something wants to allocate memory, Windows wants to ensure it can promise that memory will always be there if it ever goes to get referenced. From what I understand, Linux (and I suppose MacOS) apparently allow overcommiting to some degree, but I think even they have their limits. And when things run out in those situations, things tend to be even more disastrous. Windows' philosophy seems to be to not allow it to get to that point. Linux seems more "it's on you" about everything because it puts trust and responsibility on you for a lot of things.

As for your statement about having to sacrifice storage space, you don't. The maximum size isn't necessarily the initial size, unless the user sets a large fixed size. The initial size tends to be small, 1/8th the installed RAM amount, and will only grow from there if needed (and the commit limit can grow to intermediate values between these two as well, so it's not an either or). It only takes that space if needed. It's adaptable. And it your workload does grow to claim that space, meaning your workload commits a lot more than it uses, that's not really Windows' fault.

Disabling the page file works if you don't push your RAM, but you're losing access to all of your RAM. If you have more memory than you need, this is a non-issue. I think disabling the page file if you truly have a lot of RAM is fine if you want to assume that risk, but I don't like seeing others suggest they "should" disable or limit it by default. Just beware of running into the issue I did once I started needing more of my memory. Having to double down on RAM to go without a page file wasn't my idea of fun. It merely worked since I didn't need the 16 GB in the first many years I had it.

And I think many of us were just younger and wanting to experiment more back then, but that's just a guess on my part. Windows XP also set a larger initial page file size (times and a half RAM) which may have further led to some of us wanting to cut it back. We were also off the back of Windows 9x and a lot was just different back then.
 
Joined
Jul 25, 2006
Messages
13,179 (1.97/day)
Location
Nebraska, USA
System Name Brightworks Systems BWS-6 E-IV
Processor Intel Core i5-6600 @ 3.9GHz
Motherboard Gigabyte GA-Z170-HD3 Rev 1.0
Cooling Quality case, 2 x Fractal Design 140mm fans, stock CPU HSF
Memory 32GB (4 x 8GB) DDR4 3000 Corsair Vengeance
Video Card(s) EVGA GEForce GTX 1050Ti 4Gb GDDR5
Storage Samsung 850 Pro 256GB SSD, Samsung 860 Evo 500GB SSD
Display(s) Samsung S24E650BW LED x 2
Case Fractal Design Define R4
Power Supply EVGA Supernova 550W G2 Gold
Mouse Logitech M190
Keyboard Microsoft Wireless Comfort 5050
Software W10 Pro 64-bit
Right. But if your room has space for 2 chairs and a table, but refuses entrence if you put mroe then a table into the room, THAT doesnt make any sense. That's what MS's commit limit is doing.

MS forces you to have a page file large enough to hold a hypothetical commit larger then what you are actually using to use your phsyical RAM.
You just keep demonstrating you don't understand how it works.

You can't knock down the walls of that room to make more space. So, if the room holds 2 chairs and a table, then that "IS" what the commit limit allows. So here you complain the space is not big enough (or the doorman won't let you in - which is just wrong). That said, and once again, Microsoft wisely made the setting dynamic. So if you try to squeeze in a bigger table - guess what? Windows will dynamically increase the PF size, thus increasing the commit limit.

But then you complain the page file is taking up too much room. You can't make up your mind.

I dont use windows, I use linux. And I dont have these issues.
And it shows.

For the record (as seen in my System Specs) this system has 32GB of RAM installed. Here is a screen shot showing how my Windows managed PF is hogging massive amounts of my disk space. :rolleyes:

my PF settings.JPG


Anyway, this has nothing to do with the OP's apparent memory leak. So this time, for real, I am moving on.
 
Joined
Mar 6, 2017
Messages
3,332 (1.18/day)
Location
North East Ohio, USA
System Name My Ryzen 7 7700X Super Computer
Processor AMD Ryzen 7 7700X
Motherboard Gigabyte B650 Aorus Elite AX
Cooling DeepCool AK620 with Arctic Silver 5
Memory 2x16GB G.Skill Trident Z5 NEO DDR5 EXPO (CL30)
Video Card(s) XFX AMD Radeon RX 7900 GRE
Storage Samsung 980 EVO 1 TB NVMe SSD (System Drive), Samsung 970 EVO 500 GB NVMe SSD (Game Drive)
Display(s) Acer Nitro XV272U (DisplayPort) and Acer Nitro XV270U (DisplayPort)
Case Lian Li LANCOOL II MESH C
Audio Device(s) On-Board Sound / Sony WH-XB910N Bluetooth Headphones
Power Supply MSI A850GF
Mouse Logitech M705
Keyboard Steelseries
Software Windows 11 Pro 64-bit
Benchmark Scores https://valid.x86.fr/liwjs3
1701624077911.png
1701623993091.png

The page file itself is only about 2.4 GBs on my system and according to System Informer, my system is actively using about 548 MBs of the page file with a peak usage of 594 MBs. The page file will always remain with a size of 2.4 GBs with a majority of that page file being empty space or filled with null data.

In fact, if we go to the Powershell prompt and execute "ls -Hidden" it will show this...
1701624568795.png

Note the "-a-hs" in the Mode column for pagefile.sys, that indicates that the file is marked as a sparse file meaning that although Windows Explorer and Powershell displays the file size of pagefile.sys as 2.38 GBs, because most of the file is filled with null data, the system only stores non-null data. To understand more about this concept, see... Sparse file - Wikipedia.
 
Joined
Aug 20, 2007
Messages
21,476 (3.40/day)
System Name Pioneer
Processor Ryzen R9 9950X
Motherboard GIGABYTE Aorus Elite X670 AX
Cooling Noctua NH-D15 + A whole lotta Sunon and Corsair Maglev blower fans...
Memory 64GB (4x 16GB) G.Skill Flare X5 @ DDR5-6000 CL30
Video Card(s) XFX RX 7900 XTX Speedster Merc 310
Storage Intel 905p Optane 960GB boot, +2x Crucial P5 Plus 2TB PCIe 4.0 NVMe SSDs
Display(s) 55" LG 55" B9 OLED 4K Display
Case Thermaltake Core X31
Audio Device(s) TOSLINK->Schiit Modi MB->Asgard 2 DAC Amp->AKG Pro K712 Headphones or HDMI->B9 OLED
Power Supply FSP Hydro Ti Pro 850W
Mouse Logitech G305 Lightspeed Wireless
Keyboard WASD Code v3 with Cherry Green keyswitches + PBT DS keycaps
Software Gentoo Linux x64 / Windows 11 Enterprise IoT 2024
I didn't try to invent anything, just solving a simple problem on my own. Now I keep on working with it just to learn from it.

Thanks for the tip.


If anyone interprets my posts as me bragging about what I've accomplished, well that's not what's going on. I mean, it's like two lines of code lol..
I just wanted some help, and I'm thankful for all the help I've been getting
Oh no that's not how you came across at all, no worries.
 
  • Like
Reactions: SL2
Joined
Jul 9, 2016
Messages
1,078 (0.35/day)
System Name Main System
Processor i9-10940x
Motherboard MSI X299 Xpower Gaming AC
Cooling Noctua NH-D15S + Second Fan
Memory G.Skill 64GB @3200MHz XMP
Video Card(s) ASUS Strix RTX 3090 24GB
Storage 2TB Samsung 970 EVO Plus; 2TB Corsair Force MP600; 2TB Samsung PM981a
Display(s) Dell U4320Q; LG 43MU79-B
Case Corsair A540
Audio Device(s) Creative Lab SoundBlaster ZX-R
Power Supply EVGA G2 1300
Mouse Logitech MK550
Keyboard Corsair K95 Platinum XT Brown Switches
Software Windows 10 Pro
Benchmark Scores Cinebench R20 - 6910; FireStrike Ultra - 13241; TimeSpy Extreme - 10067; Port Royal - 13855
That's not how it works. Like I said, RAM usage won't budge for three days, and after that it increases by about 6 GB per hour. I have had task manager open on a separate display, keeping a close eye on it.
The leak kicked in yesterday like predicted. When I left home the paged pool was about 500 MB, and when I came home an hour later it was 6,2 GB, and I could see it go up with about 100 MB at a time. Non-paged had gone up to about 1 GB too. This is totally expected behavior based on what I ve seen before.

No, only using this:
Code:
using System;
using System.Media;
using System.Threading.Tasks;

I dunno, like I said before, I'm sceptical about Thread.Sleep().

___________________________________________________________

Currently I'm running with a 1 second delay (down from 10), just to see if the problem kicks in earlier. My bet is no, but I'm only 9 hours in so it's to early to tell.
So I ran your code as is, and noted the memory usage at different interval -
Before start -
1701648356811.png

20 minutes in -
1701648391855.png

30 minutes in -
1701648408000.png

40 minutes in -
1701648425649.png

50 minutes in -
1701649175119.png

1 hour and done -
1701648491774.png

I can see the memory usage indeed goes up, in 1 hour it used up 15MB. This is the expected behavior as I have said, every Task.Run is going to allocate memory, and since this is an infinite loop, there is no garbage collection performed until the the program exits. By extrapolating the calculation, if you keep the program running all the time (without shutting down or rebooting your PC), it may use up 360MB in 1 day. I don't remember how many days went by before your PC ran out of memory, but you can do that math.
Also, installing System.Windows.Extensions nuget package is required for me. I don't know what you want your program to do, but you can try to put the thread to sleep instead of Task.Run, or perhaps you you can take your question over to Stackoverflow and there are many people that will help you, or better yet, try ChatGPT or Bard to help you with coding the program if you specify your requirements and problem clearly.
 

Attachments

  • 1701648464609.png
    1701648464609.png
    72.8 KB · Views: 39
Joined
Feb 1, 2019
Messages
3,606 (1.69/day)
Location
UK, Midlands
System Name Main PC
Processor 13700k
Motherboard Asrock Z690 Steel Legend D4 - Bios 13.02
Cooling Noctua NH-D15S
Memory 32 Gig 3200CL14
Video Card(s) 4080 RTX SUPER FE 16G
Storage 1TB 980 PRO, 2TB SN850X, 2TB DC P4600, 1TB 860 EVO, 2x 3TB WD Red, 2x 4TB WD Red
Display(s) LG 27GL850
Case Fractal Define R4
Audio Device(s) Soundblaster AE-9
Power Supply Antec HCG 750 Gold
Software Windows 10 21H2 LTSC
If there's any driver I suspect it's Nvidia, I've had problems with it on this one and changed the driver before. On the other hand, since the issue persisted after a driver change, maybe it's something else causing this.
Bingo for my system.

After I updated to 21H2 I noticed some weird memory utilisation issues on my system. One of them I already had on 1809 but wasnt a leak (was just high fresh boot utilisation). The other post upgrade was a leak that increased with system uptime.

Did lots of testing, the commit would keep going up yet all diagnostic tools like task manager, process hacker, and rammap would show the ram as free unused memory and all userland processes with low utilisation.

Then I decided to deliberately restart my nvidia driver (mimic what happens on a driver crash). Boom the memory leak went away. This explained why I didnt have the problem with my testing as that was using the iGPU.

I then installed my GT 1030 on my 9900k currently being used for testing, immediately after installing Nvidia driver the on boot high memory usage showed up (so now I know thats Nvidia also), and left it running idle for days and days, and sure enough it was leaking also, fresh install of windows.

I am going to try out this poolmon tool it has peaked my interest.

Using the igpu as primary desktop GPU prevents the leaking which is nice as thats my plan for this system, but the high boot up usage appears simply from installing the driver. The Nvidia driver is also causing very high commit to physical ram usage ratio as well. Some crazy stuff.

My theory as to why 1809 was ok is 21H2 has more system processes utilising GPU acceleration. (textinputhost and searchapp).

The sooner I get iGPU as my desktop GPU permanently the better.
 
Last edited:

SL2

Joined
Jan 27, 2006
Messages
2,454 (0.36/day)
So I ran your code as is, and noted the memory usage at different interval -
Thanks for trying out the code! What I'm most interested in is what happens on day three. I've tried to explain two times already that that something else is happening at that point.

What you're showing doesn't explain the memory usage after 72 hours. Looking at the paged pool alone, it would take 2266 hours going from ~0.5 GB to 33.8 GB with a rate of 15 MB/h. Instead, it takes a few hours after day three.

1701655847427.png

As for VS, I don't have any packages installed here, which makes me wonder why you have to.
1701656351814.png
 
Joined
Jun 3, 2008
Messages
750 (0.12/day)
Location
Pacific Coast
System Name Z77 Rev. 1
Processor Intel Core i7 3770K
Motherboard ASRock Z77 Extreme4
Cooling Water Cooling
Memory 2x G.Skill F3-2400C10D-16GTX
Video Card(s) EVGA GTX 1080
Storage Samsung 850 Pro
Display(s) Samsung 28" UE590 UHD
Case Silverstone TJ07
Audio Device(s) Onboard
Power Supply Seasonic PRIME 600W Titanium
Mouse EVGA TORQ X10
Keyboard Leopold Tenkeyless
Software Windows 10 Pro 64-bit
Benchmark Scores 3DMark Time Spy: 7695
Play a soundfile (silence) every tenth second.
Why? That seems so pointless. There must be a reason. Isn't silence otherwise constantly "playing"?
 

SL2

Joined
Jan 27, 2006
Messages
2,454 (0.36/day)
Why? That seems so pointless. There must be a reason. Isn't silence otherwise constantly "playing"?
There is a reason, I've explained it. That's not what the thread is about. ;)
 
Joined
Jun 3, 2008
Messages
750 (0.12/day)
Location
Pacific Coast
System Name Z77 Rev. 1
Processor Intel Core i7 3770K
Motherboard ASRock Z77 Extreme4
Cooling Water Cooling
Memory 2x G.Skill F3-2400C10D-16GTX
Video Card(s) EVGA GTX 1080
Storage Samsung 850 Pro
Display(s) Samsung 28" UE590 UHD
Case Silverstone TJ07
Audio Device(s) Onboard
Power Supply Seasonic PRIME 600W Titanium
Mouse EVGA TORQ X10
Keyboard Leopold Tenkeyless
Software Windows 10 Pro 64-bit
Benchmark Scores 3DMark Time Spy: 7695
I read three pages where you seem to try your hardest not to explain it. Where did you explain it?

Well, have fun! I am sure there is a better way to do whatever you are trying to do, but that doesn't seem to be your objective.

I would start by asking why you are doing what you are doing. Then I would ask if there is a better way. Whatever weird bug requires you to break the existing silence every 10 seconds in order to play silence, must have a better solution.

Isn't this something you could easily "solve" with Windows Task Scheduler? And probably more efficiently. I think the real solution would be to solve the problem which makes you have to do this in the first place.
 
Last edited:
  • Like
Reactions: SL2

SL2

Joined
Jan 27, 2006
Messages
2,454 (0.36/day)
I read three pages where you seem to try your hardest not to explain it.
Nope, you're the second person who ask.
Well, have fun! I am sure there is a better way to do whatever you are trying to do, but that doesn't seem to be your objective.
My objective, like I said, is right now to learn how this works. From the beginning it was to find the memory leak, as I had no clue it was this program that caused it. I suspected some driver, and I wasn't the only one.

I would start by asking why you are doing what you are doing.
Well, you've read all of it so you should know. ;)

I didn't try to invent anything, just solving a simple problem on my own. Now I keep on working with it just to learn from it.


Isn't this something you could easily "solve" with Windows Task Scheduler?
Way ahead of you. But you've already read it so this isn't news for you. :roll:
I'm going to set longer intervals, and if that affects how long it takes until the problem comes back then I'll start focusing on my program.
I will also replace SoundPlayer with MediaPlayer and see if that changes anything. Or set the task scheduler to start it every x second instead of looping it.
 
Joined
Jul 9, 2016
Messages
1,078 (0.35/day)
System Name Main System
Processor i9-10940x
Motherboard MSI X299 Xpower Gaming AC
Cooling Noctua NH-D15S + Second Fan
Memory G.Skill 64GB @3200MHz XMP
Video Card(s) ASUS Strix RTX 3090 24GB
Storage 2TB Samsung 970 EVO Plus; 2TB Corsair Force MP600; 2TB Samsung PM981a
Display(s) Dell U4320Q; LG 43MU79-B
Case Corsair A540
Audio Device(s) Creative Lab SoundBlaster ZX-R
Power Supply EVGA G2 1300
Mouse Logitech MK550
Keyboard Corsair K95 Platinum XT Brown Switches
Software Windows 10 Pro
Benchmark Scores Cinebench R20 - 6910; FireStrike Ultra - 13241; TimeSpy Extreme - 10067; Port Royal - 13855
Thanks for trying out the code! What I'm most interested in is what happens on day three. I've tried to explain two times already that that something else is happening at that point.

What you're showing doesn't explain the memory usage after 72 hours. Looking at the paged pool alone, it would take 2266 hours going from ~0.5 GB to 33.8 GB with a rate of 15 MB/h. Instead, it takes a few hours after day three.

View attachment 324068
As for VS, I don't have any packages installed here, which makes me wonder why you have to.
View attachment 324069
I don't know why or how the page pool works that way and frankly, as a developer, I am more concerned with writing the proper code and once that is done, the problem should resolve itself. Anyway, I tried this line to replace your Task.Run and I don't see memory growing anymore. Perhaps this will work for whatever purpose that you need..
C#:
Thread.Sleep(TimeSpan.FromSeconds(interval));
Start -
1701664686157.png

I went to have dinner and came back 2 hours later -
1701664714312.png

I am not sure why there is a drop in memory usage, perhaps some garbage collection from the previous run. Oh by the way, after running the code with playing a sound for hours, my headphone started to give a cackle noise whenever I watch YouTube. I am going to reboot my computer and hopefully the problem will go away.
 

Attachments

  • 1701664705578.png
    1701664705578.png
    95.4 KB · Views: 31
  • Like
Reactions: SL2

SL2

Joined
Jan 27, 2006
Messages
2,454 (0.36/day)
I don't know why or how the page pool works that way and frankly, as a developer, I am more concerned with writing the proper code and once that is done, the problem should resolve itself. Anyway, I tried this line to replace your Task.Run and I don't see memory growing anymore. Perhaps this will work for whatever purpose that you need..
C#:
Thread.Sleep(TimeSpan.FromSeconds(interval));
Thank you. As my code doesn't have any asynchronous tasks running anymore I have no use for Task.Run.

The reason for why I didn't see Task.Run as a problem was that memory usage kept climbing even with Thread.Sleep.

I see you don't post memory usage images from VS, you use Task manager instead. Is there any reason for that?

Here I'm running with Thread.Sleep, although sped up to 10 ms delays. Process memory is climbing, heap is not.
1701671144362.png

The thing is that if I remore sp.PlaySync() and only loop Thread.Sleep then memory stays flat.

This makes me believe that SoundPlayer is indeed not fit for this kind of work, and that old post might still hold true.
 
Last edited:
Joined
Jul 9, 2016
Messages
1,078 (0.35/day)
System Name Main System
Processor i9-10940x
Motherboard MSI X299 Xpower Gaming AC
Cooling Noctua NH-D15S + Second Fan
Memory G.Skill 64GB @3200MHz XMP
Video Card(s) ASUS Strix RTX 3090 24GB
Storage 2TB Samsung 970 EVO Plus; 2TB Corsair Force MP600; 2TB Samsung PM981a
Display(s) Dell U4320Q; LG 43MU79-B
Case Corsair A540
Audio Device(s) Creative Lab SoundBlaster ZX-R
Power Supply EVGA G2 1300
Mouse Logitech MK550
Keyboard Corsair K95 Platinum XT Brown Switches
Software Windows 10 Pro
Benchmark Scores Cinebench R20 - 6910; FireStrike Ultra - 13241; TimeSpy Extreme - 10067; Port Royal - 13855
Thank you. As my code doesn't have any asynchronous tasks running anymore I have no use for Task.Run.

The reason for why I didn't see Task.Run as a problem was that memory usage kept climbing even with Thread.Sleep.

I see you don't post memory usage images from VS, you use Task manager instead. Is there any reason for that?

Here I'm running with Thread.Sleep, although sped up to 10 ms delays. Process memory is climbing, heap is not.
View attachment 324083
The thing is that if I remore sp.PlaySync() and only loop Thread.Sleep then memory stays flat.

This makes me believe that SoundPlayer is indeed not fit for this kind of work, and that old post might still hold true.
No particular reason other than I just ran it instead of debug. Debug will take up more memory because there are other libraries loaded for debug. The best way to monitor is to build it as EXE and run it that way.

I don't know much about SoundPlayer so you will have to figure out the best way for your use case.
 
  • Like
Reactions: SL2

Mussels

Freshwater Moderator
Joined
Oct 6, 2004
Messages
58,413 (7.94/day)
Location
Oystralia
System Name Rainbow Sparkles (Power efficient, <350W gaming load)
Processor Ryzen R7 5800x3D (Undervolted, 4.45GHz all core)
Motherboard Asus x570-F (BIOS Modded)
Cooling Alphacool Apex UV - Alphacool Eisblock XPX Aurora + EK Quantum ARGB 3090 w/ active backplate
Memory 2x32GB DDR4 3600 Corsair Vengeance RGB @3866 C18-22-22-22-42 TRFC704 (1.4V Hynix MJR - SoC 1.15V)
Video Card(s) Galax RTX 3090 SG 24GB: Underclocked to 1700Mhz 0.750v (375W down to 250W))
Storage 2TB WD SN850 NVME + 1TB Sasmsung 970 Pro NVME + 1TB Intel 6000P NVME USB 3.2
Display(s) Phillips 32 32M1N5800A (4k144), LG 32" (4K60) | Gigabyte G32QC (2k165) | Phillips 328m6fjrmb (2K144)
Case Fractal Design R6
Audio Device(s) Logitech G560 | Corsair Void pro RGB |Blue Yeti mic
Power Supply Fractal Ion+ 2 860W (Platinum) (This thing is God-tier. Silent and TINY)
Mouse Logitech G Pro wireless + Steelseries Prisma XL
Keyboard Razer Huntsman TE ( Sexy white keycaps)
VR HMD Oculus Rift S + Quest 2
Software Windows 11 pro x64 (Yes, it's genuinely a good OS) OpenRGB - ditch the branded bloatware!
Benchmark Scores Nyooom.
I didn't try to invent anything, just solving a simple problem on my own. Now I keep on working with it just to learn from it.

Thanks for the tip.


If anyone interprets my posts as me bragging about what I've accomplished, well that's not what's going on. I mean, it's like two lines of code lol..
I just wanted some help, and I'm thankful for all the help I've been getting
Nothing wrong with bragging about writing two lines of code, if it solved a problem

It caused a new one, but that's literally every programming joke ever.
 
Joined
Feb 18, 2005
Messages
5,847 (0.81/day)
Location
Ikenai borderline!
System Name Firelance.
Processor Threadripper 3960X
Motherboard ROG Strix TRX40-E Gaming
Cooling IceGem 360 + 6x Arctic Cooling P12
Memory 8x 16GB Patriot Viper DDR4-3200 CL16
Video Card(s) MSI GeForce RTX 4060 Ti Ventus 2X OC
Storage 2TB WD SN850X (boot), 4TB Crucial P3 (data)
Display(s) 3x AOC Q32E2N (32" 2560x1440 75Hz)
Case Enthoo Pro II Server Edition (Closed Panel) + 6 fans
Power Supply Fractal Design Ion+ 2 Platinum 760W
Mouse Logitech G602
Keyboard Razer Pro Type Ultra
Software Windows 10 Professional x64
My BT connection causes crackling noises when no audio is played.
If I was shot with a gun, I would go to a doctor and get them to patch me up.

You'd stick a sex toy in the bullet hole, then complain it's caused the wound to get infected and now your family members have to care for you.

Fix the actual problem in a sane way - like, IDK, switching out the problematic BT hardware - instead of coming up with an objectively insane "solution" that not only does not fix it, but causes more problems for other people like us. "If it's stupid but it works, it's not stupid" is not always true.
 
Joined
Jan 7, 2022
Messages
131 (0.12/day)
Processor Intel i5 9400f
Motherboard MSI Z390 Gaming Plus
Cooling SilentiumPC Fera 3
Memory 2x 8GB Corsair Vengeance LPX 3200 16-18-18-36
Video Card(s) MSI GTX 1660 Super Ventus XS OC
Storage 500 GB Kingston A2000; 1 TB Kingston A2000; 1 TB HGST Travelstar
Display(s) AOC 24G2U
Case SilentiumPC Signum SG1
Audio Device(s) Creative Pebble Plus; Logitech G533
Power Supply beQuiet Systempower 9 500W
Mouse Logitech G403 Hero
Keyboard HyperX Alloy Origins (Red)
Software Windows 10 Pro
Thank you. As my code doesn't have any asynchronous tasks running anymore I have no use for Task.Run.

The reason for why I didn't see Task.Run as a problem was that memory usage kept climbing even with Thread.Sleep.
Have you tried using PlayLooping() instead and just never stopping it. Might sidestep your problem as well. The only other thing I see is that t doesn't really need to be a variable. A constant or just using a literal should be fine.
As to no rising memory usage if PlaySync is removed: are you compiling on debug or release? On release I wouldn't be surprised if the compiler just optimizes the entire loop away since it only sleeps at that point.
 
  • Like
Reactions: SL2
Top