The @hadley Advanced R app has a fantastic explanation for closing functions that surround, execute, and invoke environments.
In your specific example, as noted in the comments, the size of the object along with its environment is much larger:
pryr::compare_size(y)
You can see the objects that this entails, and their relative sizes with this:
sapply(codetools::findGlobals(y), function(x) object.size(get(x, environment(y))))
You can summarize the last vector to see that this is really what pryr::object_size
(164 kB on my machine).
source share