Unique is probably not good for database connection: you then can't have connection in two variables, also if it holds a reference to GC-allocated memory, it can't be put to GC-allocated memory, since when that GC-allocated memory is collected, Unique will try to destroy its possibly already freed object resulting in use after free. RefCounted is ok, it has calls to GC in order to be scanned for GC references, though destructors during collection are called in a different thread, so the counter can be decremented incorrectly. Phobos tends to have specialized types like File and RcString, but they have the same problem with reference counting during collections.

Reply via email to