[Issue 4358] Potential Memory Leaks in std.file.read() ?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 08:23:52 PDT 2010


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



--- Comment #7 from nfxjfg at gmail.com 2010-06-22 08:23:51 PDT ---
std.file.read returns a void[], but it's allocated manually via gc.malloc(),
and I think the no-pointers thing was done right.

The correct solution to this problem would be to apply the patch in bug 3463
(precise heap scanning), and then probably investigate precise stack scanning.

I believe the patch in bug 2927 (no interior pointers attribute) would not roll
well with Andrei's safety ideology, so let's forget that.

Note that enhancement 2927 could be simulated by using a wrapper object, that
behaves like an array, but actually uses C malloc to allocate memory. When the
wrapper gets collected, its finalizer can free() the memory. Or using reference
counting, like (I believe) Andrei's TightArray (or what was it named) does.

-- 
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