Garbage Collection Pitfall in C++ but not in D?

Alex Rønne Petersen alex at lycus.org
Fri Jul 6 13:37:49 PDT 2012


On 06-07-2012 22:07, akaz wrote:
> On Friday, 6 July 2012 at 15:39:40 UTC, Alex Rønne Petersen wrote:
>> On 06-07-2012 16:07, Denis Shelomovskij wrote:
>>> 06.07.2012 17:43, akaz пишет:
>>>> Hi,
>>>>
>>>> Reading about the C++11, I stumbled upon this:
>>>>
>>
>> I'll just add: Handling this case is basically impossible to do
>> sanely. You can't really know what some pointer off the bounds of a
>> managed memory region is based on. It could literally be based on any
>> memory region in the entire program. You could do heuristics of
>> course, but . . .
>
> Is not possible to make use of addRange() and removeRange() to "block"
> the GC over a specified time/range?

Those just add root ranges, i.e. areas of memory that will be scanned 
for [interior] pointers during the marking phase. It still won't solve 
the problem.

You can disable the GC entirely with GC.disable().

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org




More information about the Digitalmars-d-learn mailing list