From mtmorgan at fhcrc.org  Mon Feb 10 08:24:33 2014
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Sun, 09 Feb 2014 23:24:33 -0800
Subject: [Rd] eapply duplicates elements unnecessarily
Message-ID: <52F87EB1.3020101@fhcrc.org>

eapply duplicates the elements of the environment it is being applied to

 > env = new.env(); x = 1; tracemem(x)
[1] "<0x1758cd18>"
 > env[["x"]] = x
 > xx <- eapply(env, length)
tracemem[0x1758cd18 -> 0x1758cbc8]: eapply

but duplication seems unnecessary. I think this is because of 'duplicate' in 
FrameValues (envir.c:2402). It's hard to tell what contract FrameValues is 
living up to, but is  INCREMENT_NAMED() sufficient? (the PROTECT on value in 
line 2398 also seems unnecessary -- it must already be protected?)

Martin
-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



[Rd] eapply duplicates elements unnecessarily
Martin Morgan