exception : : Java.lang.OutOfMemoryError

Posted on 2005-04-20
Last Modified: 2010-03-31
i need to load a huge jpg image withe huge resolution
hawever it seems the java memory can not load it and
it print the folowing message :

exception : : i need to load a huge jpg image withe huge resolution
hawever it seems the java memory can not load it and
he print the folowing message :

exception : : Java.lang.OutOfMemoryError

Any solution?
thank you!
Question by:a_hic
    LVL 92

    Accepted Solution

    increase the available memory

    java -Xmx128m .....
    LVL 86

    Expert Comment

    You can set memory params in the vm. Run

    java -X
    LVL 24

    Expert Comment

    What is the size of the picture?
    Normally you get a limit of 64Mb so a picture of 20Mb should load.
    Memory consumption needs to be predictable, otherwise
    your program has a problem.

    LVL 16

    Expert Comment

    Can you show a piece of the loading code?

    Author Comment

    i try it but i c'ant expecte the size of image

    i have one information : the size of image it's very huge

    the only solution it's the GRAPAGE COLLETOR

    thank you gay
    LVL 24

    Expert Comment

    No, the garbage collector can only return memory that you already used.

    Give the above suggestion a try:  java -Xmx128M <your class>


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now