B4J Question ImageView x OutOfMemoryError

Discussion in 'B4J Questions' started by cmartins, Aug 18, 2015.

Similar threads

B4J Tutorial Working with JavaFX Scene Builder
B4J Code Snippet Measure Multiline Text Height
B4J Library [class] CSS Utils
B4J Code Snippet Get Image Pixels
B4J Code Snippet Scrollbar Size
B4J Tutorial Mix text and icon on button and other nodes
  1. cmartins

    cmartins Member Licensed User

    Hi Guys,


    I have some issue with imageview, i Put it listview, and the program refresh every 15 seconds reloading all message again.

    After some 10 minutes the program crash.

    please see the error below

    Code:
    java.lang.OutOfMemoryError: Java heap space
        at com.sun.javafx.iio.jpeg.JPEGImageLoader.load(JPEGImageLoader.java:
    226)
        at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:
    309)
        at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:
    286)
        at com.sun.javafx.tk.quantum.PrismImageLoader2.loadAll(PrismImageLoader2.java:
    93)
        at com.sun.javafx.tk.quantum.PrismImageLoader2.<init>(PrismImageLoader2.java:
    37)
        at com.sun.javafx.tk.quantum.QuantumToolkit.loadImage(QuantumToolkit.java:
    620)
        at javafx.scene.image.Image.loadImage(
    Image.java:938)
        at javafx.scene.image.Image.initialize(
    Image.java:725)
        at javafx.scene.image.Image.<init>(
    Image.java:539)
        at com.sun.javafx.scene.layout.region.BackgroundImageConverter.convert(BackgroundImageConverter.java:
    83)
        at com.sun.javafx.scene.layout.region.BackgroundImageConverter.convert(BackgroundImageConverter.java:
    37)
        at com.sun.javafx.css.StyleHelper.lookup(StyleHelper.java:
    1090)
        at com.sun.javafx.css.StyleHelper.transitionToState(StyleHelper.java:
    863)
        at javafx.scene.Node.impl_processCSS(
    Node.java:7419)
        at javafx.scene.Parent.impl_processCSS(Parent.java:
    1146)
        at javafx.scene.Parent.impl_processCSS(Parent.java:
    1153)
        at javafx.scene.Parent.impl_processCSS(Parent.java:
    1153)
        at javafx.scene.Parent.impl_processCSS(Parent.java:
    1153)
        at javafx.scene.control.Control.impl_processCSS(
    Control.java:1154)
        at javafx.scene.Node.processCSS(
    Node.java:7387)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Node.processCSS(
    Node.java:7381)
        at javafx.scene.Scene.doCSSPass(Scene.java:
    454)
        at javafx.scene.Scene.access$
    3800(Scene.java:173)
        at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:
    2204)
        at com.sun.javafx.tk.Toolkit$
    5.run(Toolkit.java:363)
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the relevant code? What is the size of the image (not ImageView)?
     
  3. cmartins

    cmartins Member Licensed User

    Project attached
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    I cannot test it as it depends on the external database.
     
  5. jmon

    jmon Well-Known Member Licensed User

    You could use loadImageSample.

    The weird thing is that in your code I don't understand why you reload the image all the time. It doesn't change, so why reloading it?
     
  6. cmartins

    cmartins Member Licensed User

    Now without any database, using only random data to populate.
     

    Attached Files:

  7. cmartins

    cmartins Member Licensed User

    I have removed the load image and decrease the timer to 3500 3.5 seconds to refresh the list and the issue persist. the app crash about 6:40". any idea?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Please use File - Export as zip when uploading projects.

    I've tried it with the ScaleTransition code commented and it didn't crash (I've changed both timers to interval to 100).
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Note that you can avoid loading the all the layouts each time. Instead go over the list items and change the text and images as needed.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice