This code will leak because a refers to b and b refers to a and there's no possibility to fix this not using WeakPtr.
import threading/smartptrs
type
Widget = object
oth: SharedPtr[Widget]
var a: SharedPtr[Widget] = newSharedPtr(Widget())
var b: SharedPtr[Widget] = newSharedPtr(Widget())
a[].oth = b
b[].oth = a
echo a
echo b
Also this code goes to infinite recursion in echos.