use __gc to destroy a weak_ptr when no longer needed
deduplicate