ToRefNum only handles Go objects, but it can be passed foreign object proxies as well. Add a check whether the object is a proxy, and if so, simply return its refnum and don't track it. Change-Id: Ib17bd11b48e472c3bec0e5fb06661b201c3dfa97 Reviewed-on: https://go-review.googlesource.com/20681 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>