getmusicbee.com

Support => Tips and Tricks => Topic started by: theta_wave on September 10, 2017, 04:15:10 AM

Title: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: theta_wave on September 10, 2017, 04:15:10 AM
For those with large libraries containing a sizeable amount of metadata, MusicBee tends to use a lot of memory.  The problem is that once it reaches a threshold (.NET threshold for 32bit programs is 1.3 GB), System.OutOfMemoryException error messages (https://getmusicbee.com/forum/index.php?topic=22582.0) will pop up and sometimes cause MusicBee to crash.  There is a way to bump up this threshold up to 4 GB by one of two ways: 1a) Run editbin.exe included in a package by Steven or 1b) run editbin.exe included in Microsoft Visual Studio (Community Edition).

Which way is easier?  "1a" should do the trick in one step, but if you are OCD and absolutely need to know whether editbin.exe worked, then "1b" is the way to go.  Besides, if editbin.exe doesn't work, then you won't see MusicBee run significantly above 1.3GB in task manager before crashing.

1a) Editbin.exe from Steven's package

i) Download link: https://www.mediafire.com/file/9h6dxa3wcg84tdh/EditBin.zip/file

ii) Extract all three files from it and copy it to MusicBee's program directory (usually, C:\Program Files (x86)\MusicBee\)

iii) Run the following command (Go to MusicBee's program directory in explorer and type "cmd.exe" (without quotes) in the address window and hit enter):

Code
editbin /LARGEADDRESSAWARE MusicBee.exe

1b) Editbin.exe from Visual Studio

i) Download Microsoft's Visual Studio IDE (Community Edition) installer: https://www.visualstudio.com/

ii) Run the installer

iii) Click the "Individual components" tab and select "C++/CLI support" and "VC++ 2017 v141 toolset (x86,x64)" and finish the install

iv) Open up notepad and create a batch file with the content below.  Save it as "Filename_of_your_choice.bat" anywhere in your computer.

Code
@echo off
ECHO -------------------------------------------------------
echo Musicbee (LargeAddressAware)
Echo.
Echo Choose what do you want to do...
Echo 1. Enable /largeaddress aware flag
Echo 2. Check the status of MusicBee.exe
Echo.
ECHO -------------------------------------------------------

CHOICE /C 12 /M "Select one:"

:: Note - list ERRORLEVELS in decreasing order
IF ERRORLEVEL 2 GOTO CHECK
IF ERRORLEVEL 1 GOTO ENABLE

:CHECK
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\dumpbin.exe" /HEADERS "C:\Program Files (x86)\MusicBee\MusicBee.exe" | more

:ENABLE
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\editbin.exe" /LARGEADDRESSAWARE "C:\Program Files (x86)\MusicBee\MusicBee.exe"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\dumpbin.exe" /HEADERS "C:\Program Files (x86)\MusicBee\MusicBee.exe" | more

v) Double click the bat file you just created.

Checking whether it worked, those who followed 1a earlier proceed to 1a below; likewise those who followed 1b above proceed to 1b below.

1a) Dumpbin.exe from Visual Studio

i) Install Microsoft Visual Studio according to 1b)-i) through iii)

ii) Hit Windows Button+R, type cmd.exe and press enter

iii) Copy and paste the following in the command line:

Code
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\dumpbin.exe" /HEADERS "C:\Program Files (x86)\MusicBee\MusicBee.exe" | more

iv) Hit enter

v) The result should match the highlighted message from the picture below: "Application can handle large (>2GB) addresses."

1b) From the .bat file made earlier

The bat file you made should produce a screen similar to the one below.  Pay attention to the highlighted portion: "Application can handle large (>2GB) addresses."

(http://i.imgur.com/B8V8YYM.jpg)
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: stewlewis on October 07, 2017, 09:55:02 PM
http://www.ntcore.com/4gb_patch.php (http://www.ntcore.com/4gb_patch.php)

I've used this before on Serato, don't know ifnit helped, or if it does the same as you described easily.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: theta_wave on October 08, 2017, 03:01:22 PM
http://www.ntcore.com/4gb_patch.php (http://www.ntcore.com/4gb_patch.php)

I've used this before on Serato, don't know ifnit helped, or if it does the same as you described easily.
Most likely.  One can use the dumpbin.exe method in my post to check if the executable is patched properly or see if Musicbee goes above 1.3GB of RAM usage without crashing.  It is just that the way I described is pretty transparent on what's happening whereas your linked patcher is a black box.  Who knows what else it does.  People are free to choose of course.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: theta_wave on October 23, 2017, 04:46:38 AM
I edited the bat file in for 1b, where a menu prompt is presented to the user upon running it (CTRL+C at any time to exit from it):

(https://i.imgur.com/33pIxVj.jpg)
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: Mr. Trev on October 24, 2017, 04:41:11 PM
Couple of questions:

I assume this will work for the portable version?
Does this need to be done everytime a patch is applied?
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: Steven on October 24, 2017, 06:04:47 PM
It will work with all versions and would need to be re-applied each patch.
However it should be extremely rare that anyone would need to do this ie. you would need to have a large library with a lot of metadata for each file
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: mindlessbuddha on August 02, 2018, 04:11:09 PM
Is this still a relevant way to solve this problem.  I have a large external drive of music files with lots of metadata, experiencing crashes when used for a long time or if the computer sleeps. 1a link doesn't work to download without signing up for something and the link also brings up a bunch of junk popup windows. seems super suspicious and asked for permissions.  1b instructions are a bit dated now. I don't have the exact same selections as listed in the instructions.  If this is still good, can we get updated information/links.  Thanks! I'd really like to fix this crash issue and this seems like the only thread that addresses my exact problem.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: theta_wave on December 29, 2018, 11:02:58 PM
1b instructions are a bit dated now. I don't have the exact same selections as listed in the instructions.  If this is still good, can we get updated information/links.  Thanks! I'd really like to fix this crash issue and this seems like the only thread that addresses my exact problem.
Can you list (or post a screenshot) of the options listed to you by the installer for the community edition of Visualstudio (community edition)?
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: Timechaser on February 19, 2019, 03:36:41 PM
is there way somebody can re upload the editbin.exe file?
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: Steven on April 21, 2020, 08:21:08 AM
I have uploaded editbin and the associated required files
https://www.mediafire.com/file/9h6dxa3wcg84tdh/EditBin.zip/file

you need to run:
editbin /LARGEADDRESSAWARE MusicBee.exe
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: sveakul on April 23, 2020, 06:10:28 PM
As an add-on to the "Checking whether it worked" section in theta_wave's original post, if you don't want to have to download the VS Community Tools package just to get at dumpbin.exe, the small app "wumpbin" will do the same thing, despite it's being a bit dated.  Check it out here:  http://www.benf.org/other/wumpbin/index.html (http://www.benf.org/other/wumpbin/index.html) .

(https://i.imgur.com/I5GpQab.png)
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: sveakul on March 31, 2021, 01:36:15 AM
Besides using wumpbin.exe or dumpbin.exe, another way to verify that the LARGEADDRESSAWARE flag has been set by editbin.exe is to use the small GUI app "Large Address Aware 2.0.4 (NetFramework 4.5 version)" available at the bottom of the post here: https://www.techpowerup.com/forums/threads/large-address-aware.112556/ (https://www.techpowerup.com/forums/threads/large-address-aware.112556/) .

Select the app's "Intermediate" Mode first, then use "Add Files" which results in an immediate "read" of the flag.  The picture below shows the result for a copy of MusicBee.exe that just had the flag set using Steven's EditBin.zip package:

(https://i.imgur.com/Bc0QZZ9.png)

I confirmed that the file is not altered in any way by LAA 2.0.4 itself during the read-only process by doing before and after SHA-256 hash shots of the file just after using editbin.exe to set the flag and then after the LAA 2.0.4 "read" of the file.

The app can actually be used to set the flag itself (no editbin.exe), but since the hash obtained using that method did not match the hash using editbin, I would strongly advise NOT using LAA 2.0.4 to set the flag, only to confirm it has been set by editbin.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: jpirez on December 29, 2021, 07:06:40 PM
Hi

I have followed Steve's instructions but I am getting this error:

LINK : fatal error LNK1104: cannot open file 'MusicBee.exe'

Any advice?

Thanks in advance
Jose
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: sveakul on December 29, 2021, 07:49:44 PM
Are you using the "Windows Store" version of MusicBee?  If so, the whole process will not work.

If you have the Portable or Installer versions:

1. Be sure you are running editbin.exe from the same folder as MusicBee.exe

2.  Be sure you downloaded the "revised" version of the package from Steven's newer post here: https://getmusicbee.com/forum/index.php?topic=22778.msg173343#msg173343 (https://getmusicbee.com/forum/index.php?topic=22778.msg173343#msg173343) , and that you put the other two files in the zip, link.exe and tbbmalloc.dll, in the folder with editbin.exe and MusicBee.exe.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: jpirez on December 30, 2021, 10:59:01 AM
Hi

I had to move the musicbee.exe from C: to another drive and then I was able to apply the patch successfully. Otherwise Windows 11 would not allow it.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: jpirez on December 30, 2021, 01:02:06 PM
Despite successfully patched I still get the Out of memory error

MusicBee v3.4.8033.18564D  (Win10.0), 30 Dec 2021 13:00:

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 #=z9xpOhZZF8416QDRVkDgFBYAbLk3$.#=znsOQyRbFtCjCYQqXXzOi7h8=(Object #=z09rm0$E=, EventArgs #=z5EKpxKY=)
   at System.Windows.Forms.ToolStripDropDownItem.OnDropDownShow(EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnDropDownShow(EventArgs e)
   at System.Windows.Forms.ToolStripDropDownItem.ShowDropDownInternal()
   at System.Windows.Forms.ToolStripDropDownItem.ShowDropDown(Boolean mousePush)
   at System.Windows.Forms.ToolStripMenuItem.OnMenuAutoExpand()
   at System.Windows.Forms.MenuTimer.OnTick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: sveakul on December 30, 2021, 07:27:40 PM
Just to be sure, did you happen to apply a MusicBee update patch AFTER successfully updating the original version to LARGEADDRESSAWARE?  The process needs to be re-run every time the exe is updated.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: jpirez on December 30, 2021, 07:47:41 PM
Yes, I did
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: jpirez on December 30, 2021, 08:28:15 PM
I just applied the  LARGEADDRESSAWARE patch as per instructions, and I still have the same problem.
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: sveakul on December 30, 2021, 09:47:26 PM
Check MusicBee.exe out with wumpbin--do the results verify LAA?

https://getmusicbee.com/forum/index.php?topic=22778.msg173564#msg173564 (https://getmusicbee.com/forum/index.php?topic=22778.msg173564#msg173564)
Title: Re: How to enable MusicBee to run up to 4GB of memory (System.OutOfMemoryException)
Post by: jpirez on December 31, 2021, 08:38:08 AM
Yes, it can handle LAA.
This problem only started when I moved to Windows 11

FILE HEADER VALUES
             14C machine (x86)
               3 number of sections
        61CB9B9D time date stamp Tue Dec 28 23:19:57 2021
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             12E characteristics
                   Executable
                   Line numbers stripped
                   Symbols stripped
                   Application can handle large (>2GB) addresses
                   32 bit word machine