Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check size of object when read from file

Tags:

r

Is there a way of checking the size of a file which has been read in? I am specifically trying to figure out the in-memory size of a shapefile read in by the maptools library:

df = readShapeSpatial("/path/file.shp")
like image 634
user702432 Avatar asked Mar 22 '12 05:03

user702432


People also ask

How do you find the size of an object?

One way to get an estimate of an object's size in Java is to use getObjectSize(Object) method of the Instrumentation interface introduced in Java 5. As we could see in Javadoc documentation, the method provides “implementation-specific approximation” of the specified object's size.

Can you find the file size the number of bytes using the file class?

Get file size in java using FileChannel class We can use FileChannel size() method to get file size in bytes.

How do I check the size of a file in Python?

Use os.path.getsize() function Use the os. path. getsize('file_path') function to check the file size. Pass the file name or file path to this function as an argument.

What is the size of an object of a class?

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.


2 Answers

object.size(df) ..................................
like image 167
IRTFM Avatar answered Oct 16 '22 06:10

IRTFM


See ?object.size:

a <- runif(1e6)
object.size(a)
print(object.size(a), units="Mb")
like image 25
sgibb Avatar answered Oct 16 '22 06:10

sgibb