Author Topic: [Solved][6431] Constant "out of memory" errors, >1.2GB of memory used at startup  (Read 7229 times)

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
During the last few patches, I've been experiencing more and more "out of memory errors".  Either the one below that closes the program, or, more commonly after leaving Musicbee open for some time, the details tab in the right panel goes completely blank necessitating a restart.  With 16GB of memory, I have quite a few programs open at any time, but I still have more than 4.5GB of memory free.  With my large library (and its metadata), is Musicbee hitting the 32bit process address space limit?

Code
MusicBee v3.1.6431.37338 (Win6.1), 15 Aug 2017 20:41:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark)
   at System.Threading.Thread.Start(StackCrawlMark& stackMark)
   at System.Threading.Thread.Start()
   at #=qT0m4wGFjnNcF8s$JbqVlFahzOlWu0d5Q89OpIYoDZtdEv2fq5IgbtCJu5FtK01aE.#=qFc$bFdY0DA5fm9lc_mHH$c2U1qthubzVLzNVfSobSB8=()
   at #=qT0m4wGFjnNcF8s$JbqVlFahzOlWu0d5Q89OpIYoDZtdEv2fq5IgbtCJu5FtK01aE.#=q3GklzxFwZLF$O$AaQbrEEA==(Object #=qSoI1$x9LCxOVZ6RQr0PCaQ==)
   at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback()
Last Edit: September 04, 2017, 07:49:16 PM by theta_wave

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
could you send a link to a zip of MusicBeeLibrary.mbl in the root music/musicbee folder and your settings file

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
could you send a link to a zip of MusicBeeLibrary.mbl in the root music/musicbee folder and your settings file
PM'd

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
It seems to be ok for me.
I dont think its a question of your total memory available being the issue but I strongly suspect you are hitting some sort of .NET limits (eg. memory fragmentation) because MB loads a lot of data in your case (as we have discussed before)

Unfortunately I dont have any great suggestions and it might be the case you need to consider another player.
The suggestions I do have:
- consider splitting your library into two (or more) libraries
- separate out the podcasts into a separate library (refreshing and downloading podcasts use quite a bit of memory and infact thats where the error occured in the error log but that could just be chance)

Sorry i cant be more help. I dont think any recent changes are the cause

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
It seems to be ok for me.
I dont think its a question of your total memory available being the issue but I strongly suspect you are hitting some sort of .NET limits (eg. memory fragmentation) because MB loads a lot of data in your case (as we have discussed before)

Unfortunately I dont have any great suggestions and it might be the case you need to consider another player.
The suggestions I do have:
- consider splitting your library into two (or more) libraries
- separate out the podcasts into a separate library (refreshing and downloading podcasts use quite a bit of memory and infact thats where the error occured in the error log but that could just be chance)

Sorry i cant be more help. I dont think any recent changes are the cause

Just as I feared.  Thanks for explanation Steven.

Hmmm, so I assume .NET allocates a certain amount of memory for each library loaded.  Since all of my eggs are in one basket (one library), I guess my lone library is running up against the limit of said allocation resulting in instability (and sometimes crashes).  So, sending significant portions of my library to individual libraries (e.g. separate libraries for Soundtracks and Classical) should improve performance a bit considering the amount of resources allocated to each?  What happens if I have an autoplaylist that selects tracks from all the libraries? -EDIT: only one library can be active at any given time :(
Last Edit: August 18, 2017, 02:52:18 AM by theta_wave


Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
i will give you a version tonight where this has been applied or you could try yourself if you get hold of editbin.exe from visual studio
Code
editbin /LARGEADDRESSAWARE <your compiled exe file>
also make sure you are using the latest patch version

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
http://www.mediafire.com/file/k32h8kqg219ky7w/MusicBeeLargeAddressAware.zip

includes the modified musicbee.exe and the editbin tool if you want to do it yourself in the future. I am not going to do this for the final v3.1 release but if it addresses your issues then i might do it for v3.2

theta_wave

  • Sr. Member
  • ****
  • Posts: 680

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
http://www.mediafire.com/file/k32h8kqg219ky7w/MusicBeeLargeAddressAware.zip

includes the modified musicbee.exe and the editbin tool if you want to do it yourself in the future. I am not going to do this for the final v3.1 release but if it addresses your issues then i might do it for v3.2

I'm happy to report that I have yet to experience that system.outofmemory thrown exception with the modified musicbee executable.  I saw Musicbee's memory usage rise up to 1.7GB without any stability issues (so far).  I believe my solution is to set up a batch file to run editbin with the /largeaddressware flag enabled on future Musicbee releases.  Thanks Steven!  :D

Last Edit: September 05, 2017, 06:11:28 PM by theta_wave

JosSli

  • Newbie
  • *
  • Posts: 11
This issue is still not resolved in v3.2.6760. The editbin.zip file is no longer available either. Is there still work being done to resolve this issue?

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9303
The issue was resolved for the OP. I suggest updating to 3.3 and see if that helps.
Download the latest MusicBee v3.5 or 3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Posting screenshots is here
Searching the forum with Google is  here

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
This issue is still not resolved in v3.2.6760. The editbin.zip file is no longer available either. Is there still work being done to resolve this issue?

If after updating to 3.3 as phred suggests the issue persists, you could probably apply the "editbin fix" to the exe yourself by installing the Visual Studio SDK and then following the steps here from the thread pointer from theta_wave's post (https://stackoverflow.com/questions/14186256/net-out-of-memory-exception-used-1-3gb-but-have-16gb-installed):

"In the VC/bin folder of the Visual Studio installation directory, there must be an editbin.exe file. So in my default installation I find it under C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\editbin.exe.

In order to make the program work, maybe you must execute vcvars32.bat in the same directory first. Then a:

editbin /LARGEADDRESSAWARE <your compiled exe file>

is enough to let your program use 4GB RAM."