Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (762)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (847)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  NokiaN90 leaks native memory when using Image.createRGBImage(...)?  (Read 3711 times)
0 Members and 1 Guest are viewing this topic.
Offline Abuse

JGO Ninja

Medals: 68

falling into the abyss of reality

« Posted 2006-10-04 12:59:40 »

After~20minutes of play, a dozen or so level transitions, and probably several hundred calls to image.getRGB(...) & Image.createRGBImage(...) - the handset will begin to throw an OutOfMemoryError from canvas.serviceRepaints().

This doesn't appear to occur when getRGB/createRGBImage are not used.

Has anybody encountered this or similar issues on the N90 (or similar handsets) ?
Offline caraiz

Senior Newbie

Java games rock!

« Reply #1 - Posted 2006-10-04 13:12:46 »

Symbian phones sucks a lot, with a lot of bugs, some of them still since version 7.

I dont sure about N90, but many (or all?) symbian phones have problems when you use transform in drawRegion.
If the problem is that, u can use NokiaUI api to solve it. Nokia dont recomment it, but..... it works.

Offline OverKill

Junior Devvie

Java games rock!

« Reply #2 - Posted 2006-10-04 13:31:03 »

Leak would be the wrong word. All images you load directly are set to native memory (yes, bob, bigger, better, slices, dices). When you try to free them, only the handle is freed, not the memory.
I think nokia defines it as a 'feature'.

Many symbian phones have that feature though I cannot say how many due to lack of testing.
Best thing is to write a  midlet that fills up memory with images, release a few and then try to load one again.
If it works for as many as you removed (might have gotten lucky and it freed up enough), great.
If not, it has the 'feature'.

One version is to load everything once.
as you wrote, use either the midp 2.0 rgb feature (would work for all midp2.0 devices) or nokias direct graphics stuff (would work for all nokias + has some nice features).
But if you do it this way, do NOT load the images as pngs! Like I wrote above, the leak is the image!
Dump the contents to a file (compress just as well as a png) and load the file (which is loaded to java heap).

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Ninja

Medals: 68

falling into the abyss of reality

« Reply #3 - Posted 2006-10-13 11:04:08 »

It turns out the cause of the memory leak was getDirectGraphics(...).

It was being called once per paint, but the returned DirectGraphics object was never being accessed.
Pages: [1]
  ignore  |  Print  

EgonOlsen (364 views)
2018-06-10 19:43:48

EgonOlsen (372 views)
2018-06-10 19:43:44

EgonOlsen (304 views)
2018-06-10 19:43:20

DesertCoockie (548 views)
2018-05-13 18:23:11

nelsongames (873 views)
2018-04-24 18:15:36

nelsongames (856 views)
2018-04-24 18:14:32

ivj94 (1308 views)
2018-03-24 14:47:39

ivj94 (427 views)
2018-03-24 14:46:31

ivj94 (1097 views)
2018-03-24 14:43:53

Solater (445 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!