Results 1 to 2 of 2

Thread: java memory managment

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Answers
    1

    java memory managment

    what mean by java memory managment?and what are leaks in it?


  2. #2
    Junior Member
    Join Date
    Nov 2009
    Answers
    10

    Re: java memory managment

    One strength of the Java is that it performs automatic memory management, thereby shielding the developer from the complexity of explicit memory management.

    Memory management is the process of recognizing when allocated objects are no longer needed, deallocating (freeing) the memory used by such objects, and making it available for subsequent allocations. In some programming languages, memory management is the programmer’s responsibility.

    The complexity of that task leads to many common errors that can cause unexpected or erroneous program behavior and crashes. As a result, a large proportion of developer time is often spent debugging and trying to correct such errors.

    One problem that often occurs in programs with explicit memory management is dangling references. It is possible to deallocate the space used by an object to which some other object still has a reference. If the object with that (dangling) reference tries to access the original object, but the space has been reallocated to a newobject, the result is unpredictable and not what was intended.

    Another common problem with explicit memory management is space leaks. These leaks occur when memory is allocated and no longer referenced but is not released. For example, if you intend to free the space utilized by a linked list but you make the mistake of just deallocating the first element of the list, the remaining list elements are no longer referenced but they go out of the program’s reach and can neither be used nor recovered. If enough leaks occur, they can keep consuming memory until all available memory is exhausted.

    An alternate approach to memory management that is now commonly utilized, especially by most modernobject-oriented languages, is automatic management by a program called a garbage collector. Automatic memory management enables increased abstraction of interfaces and more reliable code.

    Garbage collection avoids the dangling reference problem, because an object that is still referenced some where will never be garbage collected and so will not be considered free. Garbage collection also solves the space leak problem described above since it automatically frees all memory no longer referenced.

    Hope this will help you.
    Cheer...
    omprakash


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact