memory management

memory management

memory management in java

View Answers

February 18, 2011 at 11:57 AM

Java Memory Management

In Java, memory is allocated only to objects. There is no explicit allocation of memory, there is only the creation of new objects. (Java even treats array types as objects.) The Java runtime employs a garbage collector that reclaims the memory occupied by an object once it determines that object is no longer accessible. This automatic process makes it safe to throw away unneeded object references because the garbage collector does not collect the object if it is still needed elsewhere. Therefore, in Java the act of letting go of unneeded references never runs the risk of deallocating memory prematurely. In Java, it's easy to let go of an entire "tree" of objects by setting the reference to the tree's root to null; the garbage collector will then reclaim all the objects (unless some of the objects are needed elsewhere). This is a lot easier than coding each of the objects' destructors to let go of its own dependencies (which is a coding-level problem with C++).









Related Tutorials/Questions & Answers:
memory management
memory management  memory management in java
Memory Management
Memory Management  how can we manage memory in iphone development???   hello, you can read all the memory management rules from ADS_TO_REPLACE_1 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual
Advertisements
memory management
memory management  Why objects store in heap
iphone memory management
iphone memory management  I am confused with the memory management issue in iPhone. I do not know which variable need to release
memory
memory  what is memory
Memory
Memory   what is the different between heap memory and stack memory ? please explain with example
memory
memory   hi i am jane pls explain the difference between heap memory and stack memory
Objective-c memory management: retain and release
Objective-c memory management: retain and release... the Foundation framework deals with memory management when you create classes... how to manage memory with language Objective-C. Programmer can allocate memory
Phantom memory
Phantom memory  hello,, What is phantom memory
Phantom memory
Phantom memory  What is phantom memory
Memory - Java Beginners
Memory management in Java  Where are these Heap and Stack? Is there size fixed? what is core area in memory
Management
Management  Hi, Can anyone give me full details of Management? Thanks   Hi, Please see the thread What is management? Thanks
memory layout
memory layout  how much space does each segement(data,stack,heap,static) holds in memory? memory here refers to ram or hard disk
memory allocation
memory allocation  If we assign memory malloc(5) and access more than the assigned memory then what will happen? 1.segmentation error 2.memory leak 3.program will not compile 4.Your view
heap memory
heap memory  how long is the object stored in heap memory persist
Java memory leak
Java memory leak  What is memory leak
Memory Allocation
Memory Allocation  What Is The Order Of Execution Of Statement 1) Statement Enclosed in {}. 2) Static 3) Public Static Void Main()   When jvm loads a class, static block is executed first, then main method. And at last
memory allocation
memory allocation   class Bird { { System.out.print("b1 "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static... of execution of statement ? memory allocation ?  The code uses static
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
heap and stack memory
the difference between heap memory and stack memory   STACK memory is referred as temporary memory,if you come out of the program the memory of the variable will not no more there.[eg., int a; memory for a will not maintained
Java memory allocation
Java memory allocation  How does Java allocate stack and heap memory
heap memory in j2me
heap memory in j2me  how to get j2me heap memory size
NSMutablestring memory leak
NSMutablestring memory leak  Why i am getting the nsmutablestring memory leak "NSCFString" leak
memory areas in jvm
memory areas in jvm  what are different memory areas in jvm?plz elaborate their significance
Main memory is also known as
Main memory is also known as   Main memory of a computer is also known
ModuleNotFoundError: No module named 'memory'
ModuleNotFoundError: No module named 'memory'  Hi, My Python... 'memory' How to remove the ModuleNotFoundError: No module named 'memory'... to install padas library. You can install memory python with following command
Java memory optimization
Java memory optimization  When you think about optimization, what is the best way to find out the time/memory consuming process?  Hi, You can use memory dump and then analyze it to find the process/java code in your
heap and stack memory
heap and stack memory   hi i am jane pls explain the difference between heap memory and stack memory with example programs
UIImage imagenamed memory leak
UIImage imagenamed memory leak  Hi, Following code is creating memory leak: UIImage * img1 = [UIImage imageNamed:@"myimage.png"]; I have to replace existing image with new image. What could be the possible solution? Thanks
memory span and shrink - pointers
memory span and shrink - pointers  Memory span and shrink as per application requirement and this is one of major advantage of pointer. please explain the above statment with an example with respect to c
What is In-Memory Computing?
memory management and ability of sharing computing sessions in real time. As soon... and in-memory computing is another revolutionary steps that opens great array... proactive sectors and business purposes, in-memory computing or also commonly
Does memory for Class or Object?
Does memory for Class or Object?   Does memory for class(methods & instance variables)allocated without it's object creation?If no,then The main() itself has associated with a class for which there is no instance creation,how
Memory leak in While loop
Memory leak in While loop  How to manage a memory leak in While loop ?   make sure loop is not running infinitley. ------------------------------------ Chandraprakash Sarathe http://javaved.blogspot.com/   
GeneralBlock Memory Leak
GeneralBlock Memory Leak   Hi all, I'm testing my iPhone application using instrument test in XCode 4... but on every test it throws a GeneralBlock... to debug this kind of memory leaks in iPhone instrument test
Out Of Memory Exception Erorr
Out Of Memory Exception Erorr  hello how are you?I hope you are fine I'm using jgrasp program my problem is in java programming my program compiled... understood that I have to increase the program memory but I don't know how?! *I gone
PC Memory Store
PC Memory Store       Great use of ajax for the memory configurator tool to find compatible memory for particular computer systems. Read full Description ADS_TO_REPLACE_1
ModuleNotFoundError: No module named 'memory-tempfile'
ModuleNotFoundError: No module named 'memory-tempfile'  Hi, My... named 'memory-tempfile' How to remove the ModuleNotFoundError: No module named 'memory-tempfile' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-analyzer'
ModuleNotFoundError: No module named 'memory-analyzer'  Hi, My... named 'memory-analyzer' How to remove the ModuleNotFoundError: No module named 'memory-analyzer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-monitor'
ModuleNotFoundError: No module named 'memory-monitor'  Hi, My... named 'memory-monitor' How to remove the ModuleNotFoundError: No module named 'memory-monitor' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-tools'
ModuleNotFoundError: No module named 'memory-tools'  Hi, My Python... 'memory-tools' How to remove the ModuleNotFoundError: No module named 'memory-tools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory_utils'
ModuleNotFoundError: No module named 'memory_utils'  Hi, My Python... 'memory_utils' How to remove the ModuleNotFoundError: No module named 'memory_utils' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'arduino-memory'
ModuleNotFoundError: No module named 'arduino-memory'  Hi, My... named 'arduino-memory' How to remove the ModuleNotFoundError: No module named 'arduino-memory' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-io'
ModuleNotFoundError: No module named 'memory-io'  Hi, My Python... 'memory-io' How to remove the ModuleNotFoundError: No module named 'memory... have to install padas library. You can install memory-io python with following
ModuleNotFoundError: No module named 'memory-monitor'
ModuleNotFoundError: No module named 'memory-monitor'  Hi, My... named 'memory-monitor' How to remove the ModuleNotFoundError: No module named 'memory-monitor' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-profiler'
ModuleNotFoundError: No module named 'memory-profiler'  Hi, My... named 'memory-profiler' How to remove the ModuleNotFoundError: No module named 'memory-profiler' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-tools'
ModuleNotFoundError: No module named 'memory-tools'  Hi, My Python... 'memory-tools' How to remove the ModuleNotFoundError: No module named 'memory-tools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory_utils'
ModuleNotFoundError: No module named 'memory_utils'  Hi, My Python... 'memory_utils' How to remove the ModuleNotFoundError: No module named 'memory_utils' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-io'
ModuleNotFoundError: No module named 'memory-io'  Hi, My Python... 'memory-io' How to remove the ModuleNotFoundError: No module named 'memory... have to install padas library. You can install memory-io python with following
ModuleNotFoundError: No module named 'memory-profiler'
ModuleNotFoundError: No module named 'memory-profiler'  Hi, My... named 'memory-profiler' How to remove the ModuleNotFoundError: No module named 'memory-profiler' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'memory-tempfile'
ModuleNotFoundError: No module named 'memory-tempfile'  Hi, My... named 'memory-tempfile' How to remove the ModuleNotFoundError: No module named 'memory-tempfile' error? Thanks   Hi, In your python

Ads