This site requires JavaScript, please enable it in your browser!
Greenfoot back
Lavenger
Lavenger wrote ...

2018/4/10

java.lang.OutOfMemoryError: Java heap space

Lavenger Lavenger

2018/4/10

#
Lately I keep running into this error: java.lang.OutOfMemoryError: Java heap space whenever I press reset after test running the game that I'm making what seems to be the problem here? Is my code too big to the point that Java cannot handle it? Somebody please tell me how to fix this error... PS:It's not that it's game breaking or anything but it's mildly annoying to have to reopen the scenario everytime I want to ReRun the scenario
Recorsi Recorsi

2018/4/10

#
I have the same problem. Since i removed a very large picture from my game it got better, but im still getting this error occasionally
Lavenger Lavenger

2018/4/10

#
Recorsi wrote...
I have the same problem. Since i removed a very large picture from my game it got better, but im still getting this error occasionally
It seems like the .gif file was the one that was taking up too much space but i need that gif since it was the main theme of the game
Lavenger Lavenger

2018/4/10

#
in case if anyone needs my full error code, this is the full error code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
java.lang.OutOfMemoryError: Java heap space
    at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75)
    at java.awt.image.Raster.createPackedRaster(Raster.java:467)
    at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
    at java.awt.GraphicsConfiguration.createCompatibleImage(GraphicsConfiguration.java:186)
    at greenfoot.util.GraphicsUtilities.createCompatibleTranslucentImage(GraphicsUtilities.java:189)
    at greenfoot.GreenfootImage.<init>(GreenfootImage.java:130)
    at GifImage.loadImages(GifImage.java:127)
    at GifImage.<init>(GifImage.java:48)
    at MyWorld.<init>(MyWorld.java:7)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at greenfoot.core.Simulation.newInstance(Simulation.java:617)
    at greenfoot.platforms.ide.WorldHandlerDelegateIDE.lambda$instantiateNewWorld$7(WorldHandlerDelegateIDE.java:430)
    at greenfoot.platforms.ide.WorldHandlerDelegateIDE$$Lambda$70/25379908.run(Unknown Source)
    at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:502)
    at greenfoot.core.Simulation.maybePause(Simulation.java:305)
    at greenfoot.core.Simulation.runContent(Simulation.java:218)
    at greenfoot.core.Simulation.run(Simulation.java:211)
these lines are in red:
1
2
3
4
java.lang.OutOfMemoryError: Java heap space
    at GifImage.loadImages(GifImage.java:127)
    at GifImage.<init>(GifImage.java:48)
    at MyWorld.<init>(MyWorld.java:7)
You need to login to post a reply.