wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes permanent  memory??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "permanent  memory???" Watch "permanent  memory???" New topic
Author

permanent memory???

suavedeep kaur
Ranch Hand

Joined: Jun 02, 2008
Posts: 36
is there any concept of permanent memory ??? as far as i know there are two memory areas as explained in head first java ..... Heap and Stack

but i read somewhere that when we execute any class it gets loaded in permanent memory , first all functions are loaded .

i am totally confused about it please can anyone explain me what all happens in memory ,for my simple program as written below???


class Emp
{
String name;
int salary;
void get(String s1,int s2)
{
name=s1;
salary=s2;
}

void show()
{
System.out.println(name);
System.out.println(salary);
}

public static void main(String [] arg){
Emp e=new Emp();
e.get("mine", 2000);
e.show();
}
}
will get() , show() and main() load in something called permanent memory ???



Suavedeep kaur
SCJP
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The "permanent generation" is the area of memory where things very unlikely to be deleted by the garbage collector are loaded. This includes String literals (i.e., "the String pool" you may have heard of) and objects that represent individual classes, including their code. The permanent generation is just part of the heap, and it's not really "permanent" -- when the JVM exits, it disappears. Perhaps it should really be "the long-lasting generation", or some such.

This is a rather advanced topic, and it's neither something you should worry about, nor something that could easily be explained in detail until you've developed some more fundamental knowledge about the JVM itself.


[Jess in Action][AskingGoodQuestions]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Ernest Friedman-Hill wrote: . . . more fundamental knowledge about the JVM itself.
Look in the Bytecode Engineering Laboratory website and look for the manual.
suavedeep kaur
Ranch Hand

Joined: Jun 02, 2008
Posts: 36
still not getting the point???
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
As EFH has already told you, it is something you can get away without knowing. He has told you all you need to know.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: permanent memory???
 
Similar Threads
Doubt in String class
What is the purpose of code Emp e2=e1; and what is the benefit of this. Give output also of the prog
reference id
System.out.Println with operator ==
How Elegant Is This Solution? Can You Offer Me Recommendations?