Out of Memory Error (or, how do I work with several Full HD images?)
in
Programming Questions
•
2 years ago
Hi all,
I've got a relatively simple program that (among other things) needs to display several images at 1920x1080.
I have added four images (all .jpgs, ~300kb each) along with a few fonts (~20-500kb each) and I am now getting out-of-memory errors. I would prefer not to increase the allocated memory because this needs to work on low-grade computers.
I would like to, eventually, display dozens of images but it seems I'll need a different strategy to work with them.
Currently, I am loading them as PImages in setup() and calling them throughout the program. Is there any way to "un-load" the images after I have used them? They will be displayed in a sequential fashion, so it would be fine to un-load them after display.
thanks!
I've got a relatively simple program that (among other things) needs to display several images at 1920x1080.
I have added four images (all .jpgs, ~300kb each) along with a few fonts (~20-500kb each) and I am now getting out-of-memory errors. I would prefer not to increase the allocated memory because this needs to work on low-grade computers.
I would like to, eventually, display dozens of images but it seems I'll need a different strategy to work with them.
Currently, I am loading them as PImages in setup() and calling them throughout the program. Is there any way to "un-load" the images after I have used them? They will be displayed in a sequential fashion, so it would be fine to un-load them after display.
thanks!
- error, disabling serialEvent() for /dev/tty.usbserial-A900frjp
- java.lang.reflect.InvocationTargetException
- at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at processing.serial.Serial.serialEvent(Serial.java:238)
- at gnu.io.RXTXPort.sendEvent(RXTXPort.java:772)
- at gnu.io.RXTXPort.eventLoop(Native Method)
- at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1641)
- Caused by: java.lang.OutOfMemoryError: Java heap space
- at processing.core.PImage.init(PImage.java:194)
- at processing.core.PImage.<init>(PImage.java:161)
- at processing.core.PGraphicsJava2D.getImpl(PGraphicsJava2D.java:1796)
- at processing.core.PImage.get(PImage.java:625)
- at processing.core.PGraphicsJava2D.get(PGraphicsJava2D.java:1809)
- at processing.core.PApplet.get(PApplet.java:10402)
- at Proc__Brain_Visual_2011_09_28.serialEvent(Proc__Brain_Visual_2011_09_28.java:242)
- ... 7 more
1