This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "memory allocation" Watch "memory allocation" New topic
Author

memory allocation

Amit Saste
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 44041
    
  33
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: memory allocation
 
It's not a secret anymore!