A Simple Fix To OBS' High Memory Usage

0vm

New Member
The source code is all there
There is a release that you can run through virus-total, not obfuscated or confused in any way.

I Had the problem with high memory usage with streamlabs and normal OBS, so I stopped streaming because it made games unplayable. nothing on the forums helped me so when I got back into streaming I figured I can use GC.Collect on OBS to remove the unnecessary cache, and that completely fixed the issue I had with the RAM Usage.

If you do not trust the release, you can compile the sln yourself, the source code is right there.
 

R1CH

Forum Admin
Developer
This is strongly inadvisable. Memory is there to be used - by forcibly pruning the working set at regular intervals you will cause more page faults for no reason. When the system is under memory pressure, the kernel will page out idle pages itself. Using this program will show you a smaller number in Task Manager but at the cost of performance and a waste of available memory.
 

MrHinsh

New Member
1655296773312.png


I am getting OBS taking up 11GB of memory and then crashing and failing to close.
 

LucaNonato

New Member
Nice little tool! We're having the same issue: OBS taking 1 MB every 5-10 seconds till it crash having used all the available RAM.

Unfortunately, "RAMLimiter" crashed, too: i launched it yesterday ad 17:47 (CEST) and for a while it worked fine:

OBS: Total ram usage: 34,398328060367
OBS: Total ram usage: 34,3796439423489
OBS: Total ram usage: 34,1461406220656

and so on.

This till 2:02, when:

OBS: Total ram usage: 87,7843429017206
OBS: Total ram usage: 87,8160770093854
OBS: Total ram usage: 87,8496410048974
Eccezione non gestita: OutOfMemoryException.

Then it crashed, leaving OBS free to suck up all the RAM, and then crash as well. :)

"Eccezione non gestita" means "unhandled exception".

If there's anything i can do to help you troubleshoot this, just ask.


Cheers!
Luca
 

LucaNonato

New Member
Just happened again, with a bit more details:

Code:
Eccezione non gestita: System.Management.ManagementException: Memoria insufficiente
   in System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   in System.Management.ManagementScope.InitializeGuts(Object o)
   in System.Management.ManagementScope.Initialize()
   in System.Management.ManagementObjectSearcher.Initialize()
   in System.Management.ManagementObjectSearcher.Get()
   in RAMLIMITER.Program.OBSRamLimiter(Int32 min, Int32 max)
   in RAMLIMITER.Program.Main(String[] args)

A couple of translations:
- "Eccezione non gestita" means "Unhandled exception"
- "Memoria insufficiente" is "Insufficient memory"


Cheers!
Luca
 

bcoyle

Member
This is a temporary solution till OBS fixes it.
i applaud you for going out and trying to improve obs for all involved. you get a thumbs up from me. Does your fix keep obs from growing itself or just from chewing up free memory?
 

bcoyle

Member
This is a temporary solution till OBS fixes it.
i have found that whenever i make a source go active and finish with it, i make obs recover it's captured memory for that source by sending it a nonsense file name . i usually use ".". Then obs mem usage will go up and then back down by about the same amount it went up. i had a lot of different sources and if i didn't clear them, obs mem would just get bigger and bigger even from previous sessions. For me, when obs got near 2g, i would have lots of problems, including crashes. Now on startup, it runs about 300meg. it usually doesn't go higher than 1g for the most complicated scenes. This may not work for some people because they have and depend on permanent scenes, where i make up mine on the fly. Hope that makes sense.

It does make a source slower the next time to load, where if you never get rid of it ,it would be already loaded and in memory. Obs is designed for quick response, so you are trading SUPER response for FAST but slower response but get lower accumulated mem usage. FYI: I'm a VB.net developer

If you would like to talk to me, go ahead and DM me.

Best regards, Bill
 
Last edited:

choppir

New Member
The source code is all there
There is a release that you can run through virus-total, not obfuscated or confused in any way.

I Had the problem with high memory usage with streamlabs and normal OBS, so I stopped streaming because it made games unplayable. nothing on the forums helped me so when I got back into streaming I figured I can use GC.Collect on OBS to remove the unnecessary cache, and that completely fixed the issue I had with the RAM Usage.

If you do not trust the release, you can compile the sln yourself, the source code is right there.
Hi thank you i would love to try this - How do i install it? I have tried to read the ''README'' file, but it isnt opening :)

Thank you
choppir
 

bcoyle

Member
Hi thank you i would love to try this - How do i install it? I have tried to read the ''README'' file, but it isnt opening :)

Thank you
choppir
I also use a free utility called rammap. I set it up in the windows task scheduler to run every hour. It cleans out the windows casch memory and restores the free memory to it's max. in obs 27 (still using it), when streaming something using the vlc encoder, it goggles up memory pretty fast.
 

choppir

New Member
I also use a free utility called rammap. I set it up in the windows task scheduler to run every hour. It cleans out the windows casch memory and restores the free memory to it's max. in obs 27 (still using it), when streaming something using the vlc encoder, it goggles up memory pretty fast.
Hi bcoyle,

Ok will google it :) Do you stream 24/7?
 

choppir

New Member
Awesome! And are you doing it with OBS -> VLC player or the Media Source? I like the media source one, but stops after 3 days so struggled the past year to get it 24/7....

Maybe i should try VLC now with this plugin - work fantastic, but wish it did it automatically every hour or so...
 

bcoyle

Member
Awesome! And are you doing it with OBS -> VLC player or the Media Source? I like the media source one, but stops after 3 days so struggled the past year to get it 24/7....

Maybe i should try VLC now with this plugin - work fantastic, but wish it did it automatically every hour or so...
hi. this is a custom app I wrote. it's a vis basic program talking to obs over a web socket. I'm in beta test right now. What are you trying to do?
take a look at https://www.youtube.com/watch?v=BuxSbHgASnw
 

bcoyle

Member
i looked at it. it seems that it just something like 16 copies of vlc or obs streaming 16 different folders, each one in a loop to a youtube channel using 16 different stream keys. it's streaming 720p at maybe 2mbs. If you have 50 to 100 mbs upload, you could do it 16 channels X 2mb per channel = 32mbs. Doable.obs can be use the vlc source pointing to a folder. obs is very good at re-connecting to youtube when your connection is lost. It will always re-connect. You either need a big computer with lots of memory and speed or a few seaparate computers to share the load.
 
Top