[Issue 18613] New: Documentation: recommended construction/destruction patterns for manual memory management

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 15 00:33:06 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18613

          Issue ID: 18613
           Summary: Documentation: recommended construction/destruction
                    patterns for manual memory management
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com

A colleague couldn't find an article he expected to exist.
I'm posting this on his behalf, because bugzilla doesn't use github login
credentials "yeah I literally clicked twice, was asked for login, closed :P"

```
Coming from C++ I was looking for delete after I did my new. I then found that
there was no delete because of GC.
To stay close to my C++ approach I decided not to use GC which then prompted
the issue, how do I call the dtor + free.
Current solution, make a function myDelete that calls dtor and free by hand.
Could use an article explaining the approach and highlighting pros and cons for
each method. It would also be useful to have a section on what is the preferred
way to do this manual memory management in D and why.
```

--


More information about the Digitalmars-d-bugs mailing list