• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

memory allocation

 
Amit Saste
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we reate object of the class in java,we allocate memory using "new" opeator,pls tell me actually how much memory is allocated for that object.
eg. first f=new first();
what is the size of f?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49849
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know.

There is no simple method in Java for finding that out. There are good reasons why you don't want to know. Java is a high-level language and the sizeof operator which is found in C was excluded. That is because its only use is for programmed memory allocation and deallocation, both potent sources of subtle and dangerous errors.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic