Solved

What Does "OutOfMemoryError" Mean?

Posted on 1997-08-05
2
185 Views
Last Modified: 2010-04-16
Hi, I keep getting "OutOfMemoryError" when I switch between three pages I have that each hold three different applets.  What causes this error?   Thank you
0
Comment
Question by:dbMan
2 Comments
 
LVL 1

Accepted Solution

by:
katya062697 earned 170 total points
ID: 1224434
OutOfMemoryError means ... that the system is out of memory resources. You have 3 applets per page = 9 applets, all of which might be memory hungry. Now, applets do not give up their resources even when you move to another page, so you will have 9 applets running at the same time ==> out of memory.

Solution: implement init(), start(), stop() and destroy() methods in each of those applets.
These are called by the browser when:
init() - when applet starts first time
start() - when applet is activated (you are back to that page)
stop() - you move off the page
destroy() - browser exits
In the stop method give up all those resources (depending on the resources you are using, this might mean closing files, stopping threads, calling the garbage collector explicitely, etc.), and get them back in the start method. This way you will not have more than 3 applets running at a time. To be even more conservative, you might implement gotFocus() and lostFocus() methods for each applet to allocate and/or give up some resources, as needed.

Hope this helps.
0
 

Author Comment

by:dbMan
ID: 1224435
thanks!
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java stored proc example 9 29
tomcat administrtor 12 46
Error in @AspectJ Based AOP with Spring 2 13
Java: anonymous class 4 18
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

770 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