Implement weak boxes and ephemerons using weak references