English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hen how long this will exisit in the heap. for example in the funcation I created some Vector Object. this handle available in all over the application. mouse event program I'm trying to access the same . will it exist , if exist how long this will exist.

2007-03-27 19:09:46 · 6 answers · asked by ramarkanna 1 in Computers & Internet Programming & Design

6 answers

Every Object defined has a scope in java. All Objects are created in the Heap memory. The heap is divided into 2 generations. new objects are pushed in the Young Generation.When this memory is full a minor Garbage Collection is run. During this It checks for all objects which are no longer referenced by the Program,and removes them.By an algorithm jvm checks if the object outlives a specific time, then they are put into the Tenured Generation(Longer Duration Objects) . Thus Gc is manages the memory more efficiently .Sometimes performance Problems occur because the way the Application Utilizes memory and hence leaks and other issues occur. More of this can be found on the Sun Java Web Site. gc is a overhead and memory should be properly utilized by programmers.

2007-03-28 00:54:59 · answer #1 · answered by Satya 3 · 0 0

Heap is a kind of memory where in java ,objects only resides.Objects existence depends on the scope of where it is declared and initiated.If an object is created within a method,this locally referenced object exists only within the method and is eligible for the garbage collection after the method execution (which may delete the object from the heap) ,unless there is no reference of this object ,returned to the calling method.

2007-03-27 19:26:08 · answer #2 · answered by Gane 2 · 0 0

A heap is a dynamic location for storing global object, as opposed to stack, which contains local object.

In Java, when you create an object using new operator, it goes to heap. Java uses reference counting to manage memory. When there is no variable that "reference" (i.e., point to) the object, the object is destroyed on the next run of garbage-collector.

2007-03-27 19:28:11 · answer #3 · answered by H Pham 2 · 0 0

Heap is the part of memory that is designated for creation of objects like Vectors and others. In modern computer architecture it usually is most part of your memory.

Those Vectors will remain there as long as some pointer or handle is referring to them.

2007-03-27 19:19:33 · answer #4 · answered by Andy T 7 · 0 0

Heap is Tree datastructure, with special characterstics.
Java or JVM maintains Objects in Memory in Heap structure.

2007-03-29 17:44:16 · answer #5 · answered by Anonymous · 0 0

In java memory administration is abstracted faraway from you, garbage sequence will get rid of any unreferenced gadgets at the same time as it runs. i'm extraordinarily efficient if it trys to allocate memory and it has reached the reduce it is going to first run garbage sequence in the previous it makes a decision there is not any obtainable memory and fails. i believe you may also call the rubbish collector manually with gadget.gc(); so that you may do merchandise myObject = new merchandise(): myObject = null; gadget.gc();

2016-12-02 22:31:57 · answer #6 · answered by ? 4 · 0 0

fedest.com, questions and answers