Skip to main content

D500 memory problem on startup

5 replies [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Michael Flad

Hi,

I had to fight that problem twice during the past few months.
Two steps that helped in my case were ... I deferred some
initial resource loading for one frame and I just split my
big fat game class (this was a port from some other plattform
so it wasn't at all designed with classes in mind) into
several smaller ones resulting in .class files of only
around 40kb - I started with an almost 200kb .class (obfuscated).

The interesting point is that I didn't even separate anything
but split it just into a inheritance chain like:

Original:
class Game : extends Canvas ...

Split:
class Game1 extends Canvas
class Game2 extends Game1
class Game3 extends Game2
class Game extends Game3

Kind of a pain due to all the scope problems but this was
the only way I managed to get it to work.

What's interesting is that I know other games with .class files
of ~135kb working perfectly on that device.

Best regards,
Michael

> -----Ursprüngliche Nachricht-----
> Von: A mailing list for KVM discussion
> [mailto:KVM-INTEREST@JAVA.SUN.COM] Im Auftrag von James Closs
> Gesendet: Dienstag, 29. April 2008 17:25
> An: KVM-INTEREST@JAVA.SUN.COM
> Betreff: Re: D500 memory problem on startup
>
> Hello Kirwan,
>
> I've just found your post below whilst searching the
> KVM-Interest archives and wondered if you ever found a
> solution - I'm having the same problem with an app I'm
> developing. I'm sure this is nothing 'normal' to do with
> resource loading/heap as the game is not loading anything at
> all demanding and quits right away.
>
> best regards
>
> > Having previously had a working 73KB MIDlet on the Samsung
> D500, the
> > new version displays the message below on start up and then
> returns to
> > the downloads menu.
> >
> > "The application has unexpectedly quit because it ran out of memory"
> >
> > This started with a JAR of about 135KB, well below the
> 300KB maximum.
> > Having removed all images and some classes I'm down to
> 95KB. I've also
> > removed all references to RecordStores but still the same message
> > appears every time.
> >
> > Has anyone else had this problem and found a way to resolve it?
>
> ====
>
> James Closs, Director, bitBull Ltd
>
> http://www.bitbull.com
>
> 07771 991171
>
> ====
>
> ==============================================================
> =============
> To unsubscribe, send email to listserv@java.sun.com and
> include in the body of the message "signoff KVM-INTEREST".
> For general help, send email to listserv@java.sun.com and
> include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

James Closs

Hello Kirwan,

I've just found your post below whilst searching the KVM-Interest
archives and wondered if you ever found a solution - I'm having the
same problem with an app I'm developing. I'm sure this is nothing
'normal' to do with resource loading/heap as the game is not loading
anything at all demanding and quits right away.

best regards

> Having previously had a working 73KB MIDlet on the Samsung D500,
> the new
> version displays the message below on start up and then returns to the
> downloads menu.
>
> "The application has unexpectedly quit because it ran out of memory"
>
> This started with a JAR of about 135KB, well below the 300KB maximum.
> Having removed all images and some classes I'm down to 95KB. I've also
> removed all references to RecordStores but still the same message
> appears every time.
>
> Has anyone else had this problem and found a way to resolve it?

====

James Closs, Director, bitBull Ltd

http://www.bitbull.com

07771 991171

====

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Elliot Sumner

I remember having the same issue with a game a few years back. Its
basically because you are running out
of heap for an individual class at runtime or the entire allocation for
your MIDlet.

My _hacky_ solution was to split the app into several midlets and ensure
that each zone in game was in a seperate
class. This way you could avoid huge classes, and if your app is split
correctly, the classes for the other zones
would never be touched at the apps runtime.

If I remember correctly, the D500 would search all the classes
referenced from the MIDlet and load/recompile each one on
on boot. Debugging of the app was done blind, so it was quite long
process to get working.

Hope that helps.

James Closs wrote:
> Hello Kirwan,
>
> I've just found your post below whilst searching the KVM-Interest
> archives and wondered if you ever found a solution - I'm having the
> same problem with an app I'm developing. I'm sure this is nothing
> 'normal' to do with resource loading/heap as the game is not loading
> anything at all demanding and quits right away.
>
> best regards
>
>> Having previously had a working 73KB MIDlet on the Samsung D500, the new
>> version displays the message below on start up and then returns to the
>> downloads menu.
>>
>> "The application has unexpectedly quit because it ran out of memory"
>>
>> This started with a JAR of about 135KB, well below the 300KB maximum.
>> Having removed all images and some classes I'm down to 95KB. I've also
>> removed all references to RecordStores but still the same message
>> appears every time.
>>
>> Has anyone else had this problem and found a way to resolve it?
>
> ====
>
> James Closs, Director, bitBull Ltd
>
> http://www.bitbull.com
>
> 07771 991171
>
> ====
>
> ===========================================================================
>
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff KVM-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

--
Elliot Daniel Sumner
Mobile Developer
Emote Games Ltd.
telephone : +44 (0)151 224 7767
mobile : +44 (0)777 324 0527
skype : elliot.sumner
email : elliots@emotegames.co.uk

--
Emote Games Ltd. is a company registered in England and Wales No.
05504381. Registered office: 27 Old Haymarket, Manchester Street,
Liverpool, Merseyside L1 6ER http://www.emotegames.co.uk/

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

James Closs

Thanks a lot, that makes sense, I had a feeling it might be something
like that but didn't want to go through the pain of trying to cut out
classes etc with no indication that this might actually be the problem!

Might not bother anyway - this phone is getting very old and is
always giving me grief!

cheers

> I remember having the same issue with a game a few years back. Its
> basically because you are running out
> of heap for an individual class at runtime or the entire allocation
> for your MIDlet.

====

James Closs, Director, bitBull Ltd

http://www.bitbull.com

07771 991171

====

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

James Closs

Thought I'd update on this, turned out the issue was overall code
size. Being a bit more thorough and making sure a couple of unused
classes got obfuscated out at build time sorted the issue...

> Thanks a lot, that makes sense, I had a feeling it might be
> something like that but didn't want to go through the pain of
> trying to cut out classes etc with no indication that this might
> actually be the problem!

====

James Closs, Director, bitBull Ltd

http://www.bitbull.com

07771 991171

====

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".