how to debug memory errors

bachmeier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 8 04:14:42 PST 2016


On Tuesday, 8 November 2016 at 11:53:37 UTC, Era Scarecrow wrote:
> On Tuesday, 8 November 2016 at 11:26:55 UTC, bachmeier wrote:
>>
>> Is there a valid use case for something like this? Why would 
>> you want to do anything inside ~this with GC memory?
>
>  If we assume it's a C++ attachment/library/object using 
> different memory allocation?

I'm not sure what "it's" is referring to in your statement. In 
the example, Foo wraps manually allocated memory that is freed 
when Foo goes out of scope. If the goal is to free the memory in 
Foo when Bar goes out of scope, that can be done without error by 
rewriting Foo. Therefore I'm not understanding how this situation 
can arise in real world code (I'm sure it can, though, which is 
why I'm asking).


More information about the Digitalmars-d-learn mailing list