Using R now, and my memory is almost full(gc() applied already). Is there a way to know each variables' memory consumption so that I know which one takes the most memory and remove that one.
Asked
Active
Viewed 1.7k times
1 Answers
22
Yes there is, try:
object.size()
jhpratt
- 6,261
- 16
- 40
- 48
Matt Bannert
- 26,475
- 36
- 138
- 202
-
If you notice a large difference between the space required by your objects and their object size you can also try saving your working space via `save.image()` restarting R and loading your workspace. – David Oct 26 '13 at 19:26
-
8you could e.g. have worked out the perfect method to get a sorted human-readable list, as the asker wanted “each variables’ memory consumption”: `sizes – flying sheep May 24 '16 at 18:21
-
9Great comment. I've put these commands in a function and inverse the ordering: `list_obj_sizes – Alan Nov 16 '16 at 20:51
-
ok, I agree. Could've, SHOULD'VE. Thanks for the great additions! – Matt Bannert Mar 06 '18 at 16:56