• MyNameIsRichard@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    7 days ago

    If I do it straight after the constructor, then definitely but if I get distracted by something else then it’s only probably until I run it through valgrind and see the leak. These days, I mostly use smart pointers in new code though so there are fewer opportunities to need a destructor. It’s funny that I never forget when opening a file or db connection!