How can I assign more memory to bliss?

bliss is, by default, limited to 256MB of internal memory usage (apart from on Linux, where it's limited to 128MB). This means that bliss will use no more than 256MB internal to the bliss process. Total memory usage of the bliss process will be greater than that because of the overhead of the Java runtime environment and other requirements. This will vary from operating system to operating system. Typically, in a Windows installation, bliss should use no more than 300-320MB.

Sometimes you may receive error messages similar to:

java.lang.OutOfMemoryError: Java heap space

Or...

java.lang.OutOfMemoryError: GC overhead limit exceeded

If you receive these messages it means bliss's internal memory has been exhausted. This is a bug in bliss, so please report it. While I look at the problem, a simple workaround may be to increase the amount of memory allocated to bliss.

Allocating more memory to bliss is an advanced operation and requires editing text files. It is also dependent on your operating system. If you are uncomfortable doing this, wait for the diagnosis after you have reported the issue as I may be able to suggest an easier workaround (often it might be a specific music file causing the problem, for example).

Whichever operating system you use, first, stop bliss. Then proceed with the operating system specific instructions below...

Windows

To increase the memory allocated to bliss in Windows you must edit the bliss.l4j.ini file.

First, open up your favourite text editor. If you are using Windows Vista or later, you must do this as Administrator, otherwise you will not be able to save changes to the bliss.l4j.ini file.

Find %bliss%\bin\bliss.l4j.ini and open it inside your text editor. This will normally be C:\Program files (x86)\bliss\bin\bliss.l4j.ini. The contents should appear similar to:

-Xmx256M
-Djetty.home.bundle=com.elsten.bliss.jetty
-Dfelix.auto.deploy.dir="%EXEDIR%\\..\\bundle"
-Dbliss.bootstrapbundle.initialbundledir="%EXEDIR%\\..\\bliss-bundle"
-Dbliss.launcher="%EXEFILE%"
-Dorg.osgi.framework.storage="%HomeDrive%%HomePath%\\.bliss\\felix-cache"
-Djava.util.logging.config.file="%EXEDIR%\\..\\conf\\logging.properties"
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath="%TEMP%"
-XX:+CMSClassUnloadingEnabled

Edit "-Xmx256M" replacing 256 with the amount of MB you'd like to assign to bliss. I'd suggest you assign no more than ¼ of total system memory. The file may then look like:

-Xmx512M
-Djetty.home.bundle=com.elsten.bliss.jetty
-Dfelix.auto.deploy.dir="%EXEDIR%\\..\\bundle"
-Dbliss.bootstrapbundle.initialbundledir="%EXEDIR%\\..\\bliss-bundle"
-Dbliss.launcher="%EXEFILE%"
-Dorg.osgi.framework.storage="%HomeDrive%%HomePath%\\.bliss\\felix-cache"
-Djava.util.logging.config.file="%EXEDIR%\\..\\conf\\logging.properties"
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath="%TEMP%"
-XX:+CMSClassUnloadingEnabled

Save the file. bliss can now be run via the shortcut, Start Menu or bliss.bat batch file. Using the batch file on the command line is helpful because an error will be shown if you made a mistake editing the file.

Mac OS X

The process is a little more involved in OS X. That's because of the way the bliss "app" is distributed. All of bliss's configuration is included in the application bundle, and that bundle is code-signed. This means making edits to the file is not allowed.

So the first step is to make a copy of the bliss.app file. This is simple; if you haven't already, first drag the bliss.app file out of the bliss.dmg to a location of your choosing. Many people choose /Applications. Next, make a copy of the file. You could name it something like bliss-more-memory.app. This copy can be located anywhere.

Now we can edit the memory. A .app "application bundle" is actually a folder with a standardised layout inside (meaning the files and folders within have standardised names). It's possible to see these folders by right-clicking the app and selecting Show package contents. You can also use the command line in Terminal. Once you can see the contents, you need to locate bliss-more-memory.app/Contents/Info.plist. Open Info.plist in your favourite text editor. You should be able to find a section that looks like:

...[more settings]
		<string>-Xmx256M</string>
...[yet more settings]

That emboldened 256 is what you need to change. Replace 256 with the amount of MB you'd like to assign to bliss. I'd suggest you assign no more than ¼ of total system memory. The file may then look like:

...[more settings]
		<string>-Xmx512M</string>
...[yet more settings]

Save the file, and restart bliss from the copied bliss-more-memory.app file (or whatever you called it). bliss should start and will be assigned more memory.

Linux

Increasing the memory allocated to bliss, in Linux, involves setting the $BLISS_MAX_HEAP environment variable. This can be performed on the command line before launching the bliss shell script:

export BLISS_MAX_HEAP=512M

... sets bliss's memory assignment to 512MB. This needs to be performed once in each bash session before the script is first launched, although once it is performed it doesn't need to be done again in that session.

To make the change permanent you can add the above line into your ~/.bashrc or equivalent startup file.

Any other FAQs I forgot or clarifications required? Post your ideas below!

blog comments powered by Disqus