×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    153

    please help ,how we can remove "java.lang.OutOfMemoryError" exeption

    i am working on S40 using sdk2.0 and lwuit1.5.Now my requirement is that my application have many number of form which is move form one to another form. but many time when click the button for move to another form it throw an exception of "java.lang.OutOfMemoryError".what is the reason behind it .I think that my application have not more form it have maximum four and five .but my application will need append more form.so please tell me what Is the reason of this type of exception

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    608

    Re: please help ,how we can remove "java.lang.OutOfMemoryError" exeption

    1. this is not an Exception its an Error
    2. S40 phones have limited amount of Heap space (between 2-4MB, mostly 2MB)
    3. if you consume more memory than the phone has this error is thrown.
    4. some of the stuff that can consume the most memory when they are loaded to heap are: large images, sounds, large data arrays/stractures.
    5. my suggestion to you is to see what you can load dynamically and use it (for instance let say you have an about form with some images and text, this form doesnt need to be alive in memory through-out the life of the app since its unlikely a form that the user will visit often so its better to create it and all of its resource only when the user actually click to visit the about form).

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: please help ,how we can remove "java.lang.OutOfMemoryError" exeption

    Hello vikranttanwar@

    shai has given some good points only one thing i want to add more is about the diagnostic tool which comes with the sdk, if you observer that you can easily makeout which call or method or flow is causing memory to go up !!, then you can apply all sort of optimizations there !!

    Regards,

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    153

    Re: please help ,how we can remove "java.lang.OutOfMemoryError" exeption

    hello,can u guide me that how to use any variable which is using in midlet class in another simple java class

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: please help ,how we can remove "java.lang.OutOfMemoryError" exeption

    it should be simple pass your midlet object to that class and you should be able to use the method or variable !!

  6. #6
    Registered User
    Join Date
    May 2013
    Posts
    12

    Re: please help ,how we can remove "java.lang.OutOfMemoryError" exeption

    I had this problem when displaying a list that implements a ListCellRenderer when entered method getListCellRendererComponent() for one element

Similar Threads

  1. Replies: 8
    Last Post: 2011-10-11, 02:54
  2. "Out of Memory" not "java.lang.OutOfMemoryError
    By muditkmathur in forum Mobile Java General
    Replies: 3
    Last Post: 2007-08-08, 13:21
  3. On launch: "Error within Debug UI": java.lang.reflect.InvocationTargetException
    By jplauril in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2007-04-25, 16:20
  4. Replies: 20
    Last Post: 2007-03-04, 12:10
  5. Replies: 3
    Last Post: 2003-04-22, 00:34

Posting Permissions

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