Rust has two types called Rc and Arc that have this behavior. When you clone an Rc pointer, the internal reference count increments, and as each clone disappears, the reference count decrements. (Arc works like Rc, but it uses atomic increment and decrement operators, so you can share it across threads.)
Rc: http://doc.rust-lang.org/stable/std/rc/struct.Rc.html
Arc: http://doc.rust-lang.org/stable/std/sync/struct.Arc.html