aspose file tools
The moose likes Beginning Java and the fly likes memory allocation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "memory allocation" Watch "memory allocation" New topic

memory allocation

Amit Saste

Joined: Sep 06, 2007
Posts: 6
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

Joined: Oct 13, 2005
Posts: 43268
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.
I agree. Here's the link:
subject: memory allocation
It's not a secret anymore!