Dear all,

I am working on a 64 bits Linux system.
I issue the following R commands:

 > rm(list=ls()) # To remove all objects in the workspace.
 > gc() # To free memory.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124250 6.7 350000 18.7 350000 18.7
Vcells 124547 1.0 786432 6.0 476934 3.7
 > gc() # I had to do it again, don't know why!
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124257 6.7 350000 18.7 350000 18.7
Vcells 124574 1.0 786432 6.0 476934 3.7
 > gc() # Just to be sure things have stabilized.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124257 6.7 350000 18.7 350000 18.7
Vcells 124574 1.0 786432 6.0 476934 3.7
 > x <- as.integer(3)
 > object.size(x)
48 bytes
 > gc() # To free memory.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124255 6.7 350000 18.7 350000 18.7
Vcells 124550 1.0 786432 6.0 476934 3.7
 > gc() # I had to do it again, don't know why!
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124259 6.7 350000 18.7 350000 18.7
Vcells 124575 1.0 786432 6.0 476934 3.7
 > gc() # Just to be sure things have stabilized.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124259 6.7 350000 18.7 350000 18.7
Vcells 124575 1.0 786432 6.0 476934 3.7


My questions are:

1) Why should I use the command gc() two times before the values 
displayed do not change anymore?

2) object.size(x) is 48 bytes on my system. As I understand it, this is 
8 bytes for storing the value 3L and 40 bytes (on my 64 bits OS) to 
store the header of x. Am-I right? (Note that I understand it would be 
the same for x <- c(3L,4L))

3) If 2) is OK, then you can see that Ncells increased by 2 units and 
Vcells by 1 unit.
I think that 1 unit of Vcells = 8 bytes. Is it TRUE? (This is written in 
help(gc))
And in my mind, 1 unit of Ncells should be 20 bytes, so that:
1 unit of Vcells + 2 units of Ncells = 8 + 2*20 = 48, the size of x as 
returned by the command object.size(x).

BUT, when you look at help(gc), one can read:
'gc' returns a matrix with rows '"Ncells"' (_cons cells_), usually
28 bytes each on 32-bit systems and 56 bytes on 64-bit systems,

So, can you please help me to undertsand all of this?

Thanks in advance.

Best regards,

Pierre

-- 
Pierre Lafaye de Micheaux

Adresse courrier:
Département de Mathématiques et Statistique
Université de Montréal
CP 6128, succ. Centre-ville
Montréal, Québec H3C 3J7
CANADA

Adresse physique:
Département de Mathématiques et Statistique
Bureau 4249, Pavillon André-Aisenstadt
2920, chemin de la Tour
Montréal, Québec H3T 1J4
CANADA

Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
lafaye@dms.umontreal.ca
http://www.biostatisticien.eu

-- 
Pierre Lafaye de Micheaux

Adresse courrier:
Département de Mathématiques et Statistique
Université de Montréal
CP 6128, succ. Centre-ville
Montréal, Québec H3C 3J7
CANADA

Adresse physique:
Département de Mathématiques et Statistique
Bureau 4249, Pavillon André-Aisenstadt
2920, chemin de la Tour
Montréal, Québec H3T 1J4
CANADA

Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
lafaye@dms.umontreal.ca
http://www.biostatisticien.eu


	[[alternative HTML version deleted]]

