[Issue 9326] writeln to simply show pointed data

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 16 09:47:46 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9326



--- Comment #6 from bearophile_hugs at eml.cc 2013-01-16 09:47:44 PST ---
(In reply to comment #5)

> BTW if writeln starts allocating GC memory like that we'll have a revolt among
> users. The special case of debugging output doesn't look good enough to
> compromise the basic "no garabage involved" guarantee.
>
> Plus debug prints inside of a finalizer risk killing a program with current GC.
> This situation with GC should/might improve in the future though but it's just
> another problem to be aware of.

Thank you for the answer. I didn't know writeln has strictly zero allocations.

To detect clycles this enhancement needs some kind of set of untyped pointers.
Such pointers never get deferenced and they must not used by the GC to keep
data alive (so they are weak pointers). So such pointers are essentially of
type uintptr_t (unsigned integral type large enough to hold a pointer).

Such set of uintptr_t is allocated by the writeln, and it stops being useful
when writeln ends (so it's possible to deallocate it). So maybe if necessary
it's possible to allocate such memory from the C heap, and avoid that problem
with the finalizer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list