Ref-counting for java etc.