This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 36478
    
  16
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: http://aspose.com/file-tools
 
subject: memory allocation
 
Similar Threads
class confusion
String Object
How many objects created?
Memory issue between implements and extends
Do something with String in non-pool memory