Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How big is a class in memory?

How do I figure out how many bytes a defclass object has in Common Lisp?

like image 972
Paul Nathan Avatar asked Sep 13 '10 17:09

Paul Nathan


People also ask

How much space does a class take in memory?

In general a class or struct is a concept and does not occupy variable (data) space, but it does take up memory in the compiler's memory. If a class or struct has methods, those methods will take up code space, if the methods are executed (linkers tend to drop functions that are not used).

What is the size of a class?

Explanation: Classes doesn't have any size, actually the size of object of the class can be defined. That is done only when an object is created and its constructor is called. 7.

What is the size of a class in OOP?

The size of object of a class depends on the no. of bytes occupied by the data members of the class. }; The object of class student will occupy space of 8 bytes.

How do you determine a class size?

We also know that the class size is defined as the difference between the actual upper limit and actual lower of a given class interval. Therefore, the class size for the class interval 10-20 is 10.


1 Answers

You can't do that in portable Common Lisp.

Useful could be the function ROOM. ROOM prints memory statistics and with the argument T it prints them detailed. So you may see a difference before and after some instance creations. Implementations may have specific functions, but you need to check that with the manual or with the support mailing list.

like image 110
Rainer Joswig Avatar answered Sep 30 '22 00:09

Rainer Joswig