Results 1 to 6 of 6
  1. #1
    Jedan_covik is offline Member
    Join Date
    Aug 2012
    Posts
    8
    Rep Power
    0

    Default BufferedImage problem

    I am making image viewer application where images are loaded to memory using BufferedImage with the following code:

    Java Code:
    BufferedImage image;
    InputStream input = new FileInputStream(path);
    image = ImageIO.read(input);
    Application is made so it loads lots of images, with increased heap space up to 1GB. When runned using netbeans it works fine, loading all images it should without any problem. Using jar file it loads untill it uses about 300 mb of RAM and then it stops. I've check where the problem is, after it gets to that point it just wont create new image. I've tried with more than one set of images so image path should not be the problem i'm looking for.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: BufferedImage problem

    I have no idea what may be causing your problem, sorry.

    Have you considered using a profiler to see what is happening to your program's memory structure while its running?

  3. #3
    Jedan_covik is offline Member
    Join Date
    Aug 2012
    Posts
    8
    Rep Power
    0

    Default Re: BufferedImage problem

    I have. Like I said, no problems at all when using netbeans. Next thing i have tried was writing to .txt when running jar file to check where the code stops, and it is exactly at :

    Java Code:
    image = ImageIO.read(input);
    One very weird thing about this is also that when i interact with the program memory usage increases when it shouldn't, so thats how i'm sure it is not about heap space. This does not happen when runned using netbeans.
    Last edited by Jedan_covik; 08-30-2012 at 12:54 AM.

  4. #4
    Jedan_covik is offline Member
    Join Date
    Aug 2012
    Posts
    8
    Rep Power
    0

    Default Re: BufferedImage problem

    Looks like i only increased heap size for the version I run from netbeans, while compiled version is still on default size.
    Can someone please tell me how to increase heap size for the compiled version since i can't find a way to do it in netbeans 7.1.2 :(
    project properties->Run-> VM options only affects netbeans runned version as i see it

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,303
    Rep Power
    20

    Default Re: BufferedImage problem

    Launch the jar from a batch file (Windows) or shell script (Linux / MacOS) and supply the -Xmx flag on the command line.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: BufferedImage problem

    Lord, and I had assumed that you were already doing this. My bad!

Similar Threads

  1. BufferedImage not going to GC
    By vspin in forum New To Java
    Replies: 11
    Last Post: 07-03-2012, 09:42 AM
  2. Problem Drawing Grid with BufferedImage.
    By Shikatsu in forum Java 2D
    Replies: 10
    Last Post: 11-26-2011, 12:01 AM
  3. Problem with JFileChooser and BufferedImage Class
    By toro1984 in forum AWT / Swing
    Replies: 3
    Last Post: 11-03-2010, 10:09 AM
  4. BufferedImage rgb
    By Bill87 in forum New To Java
    Replies: 2
    Last Post: 02-25-2010, 06:31 PM
  5. free memory of bufferedimage problem
    By mr_empty in forum Java 2D
    Replies: 2
    Last Post: 01-17-2010, 06:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •