• Post Reply Bookmark Topic Watch Topic
  • New Topic

memory allocation  RSS feed

 
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
Marshal
Posts: 55789
164
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!