manual memory management

Mehrdad wfunction at hotmail.com
Tue Jan 8 22:59:27 PST 2013


On Wednesday, 9 January 2013 at 06:57:34 UTC, deadalnix wrote:
> On Wednesday, 9 January 2013 at 06:56:00 UTC, Mehrdad wrote:
>> On Tuesday, 8 January 2013 at 22:19:56 UTC, Walter Bright 
>> wrote:
>>> One thing I'd add is that a GC is *required* if you want to 
>>> have a language that guarantees memory safety
>>
>>
>>
>> Pardon?  shared_ptr anyone? You can totally have a language 
>> that only provides new/delete facilities and which only access 
>> to memory through managed pointers like shared_ptr... without 
>> a GC. I don't see where a GC is "required" as you say.
>
> Such a program is guaranteed to have memory leak, unless you 
> add a GC on top of the managed pointers.


He said _safety_... memory leaks are perfectly safe.

Then again, doesn't Java also have memory leaks when e.g. you 
create a thread and never run it? Doesn't C# have memory leaks 
when you attach an event handler to a static event and never 
remove it?

What exactly does a GC bring to the table here?


More information about the Digitalmars-d mailing list