Skip to main content

Memory leaks during xlet restart

Please note these forums are being decommissioned and use the new and improved forums at
3 replies [Last post]
Joined: 2012-04-11

I`m working on VOD application for PlayStation 3 using BDJ. I use the following code to restart xlet after VFSManager.requestUpdating (I need to call it before streaming each video):

public void restartTitle() {
try {
BDLocator loc = BDLocatorFactory.get().getJumpToTitle("1").build();
ServiceContextFactory factory = ServiceContextFactory.getInstance();
TitleContext titleContext =(TitleContext) factory.getServiceContext(context);
SIManager siManager = SIManager.createInstance();
Title title = (Title) siManager.getService(loc);
titleContext.start(title, true);
} catch (Exception ex) {
Fdl4java.error("restartTitle E->", ex);

It works just fine, but takes about 1.5 MB from PS3 memory, which I can`t retrieve. The total amount of memory allocated by PS3 for my application is about 12.5 MB. With some additional operations between playback the application lasts about 5 playbacks before it runs out of memory and throws appropriate exception.
My question is:
is there a way to prevent this leak (maybe some better way to restart an xlet) or (if not) is there a way to restart the whole application which would result in cleaning all the memory and giving me 5 more playbacks?

Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-08-26

You could try and jump to an HDMV title and have that HDMV title send you right back to your Java title. Going to an HDMV title should clear out all the memory being taken up by the Java app. I am sure there has to be a better solution than my suggestion but mine should technically work... I think...

Joined: 2012-04-11

That sounds like a good idea. The problem is - I can`t figure out how to jump to HDMV title with BDJ. How should I change the presented code to do it?

Joined: 2004-02-13

A couple things...

Nothing in the code snippet looks to be a source of resource leakage. Any leak must be elsewhere -- maybe a listener failing to de-register, maybe an application-created thread that's not gracefully exiting, maybe an image that isn't being flush()ed, or maybe something else. Debugging unintentional object retention ("memory leaks") is hard, because they could be coming from anywhere. One technique is to start with the simplest possible xlet: One that does nothing but the title change, for example, and see if you observe the problem with that. Then gradually add in functionality from the xlet in question, until you see the problem.

About HDMV: The way you do that is to switch to an HDMV title, then have that HDMV title immediately switch to a BD-J title. This is most certainly a hack, but it is known to be effective, at least on some players. The downside is that it's slow. For the best user experience, it's better if you can find and fix the source of the problem.