digitalmars.D.bugs - [Issue 1557] New: std.zlib allocates void[]s instead of ubyte[]s, causing leaks.
- d-bugmail puremagic.com (33/33) Oct 08 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1557
- d-bugmail puremagic.com (6/6) Oct 08 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1557
- d-bugmail puremagic.com (9/9) Nov 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1557
http://d.puremagic.com/issues/show_bug.cgi?id=1557 Summary: std.zlib allocates void[]s instead of ubyte[]s, causing leaks. Product: D Version: 1.022 Platform: PC URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr oup=digitalmars.D&article_id=59880 OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: fvbommel wxs.nl std.zlib allocates buffers as void[]s instead of ubyte[]s. While in each instance std.gc.hasNoPointers is promptly called on the result, there are concatenations performed with void[] arrays and those don't preserve that attribute. The URL entered is to a discussion of this bug in digitalmars.D, though it manifested in relation to GDC and I haven't verified a memory leak actually exists in the DMD version. However, the module is nearly identical and AFAIK the GC hasn't been upgraded since the version GDC was based on (1.020) either. I'm attaching a patch against DMD 1.022 std.zlib with the following changes: 1) I changed all newly-allocated arrays to ubyte[] instead of void[]. 2) I also took the opportunity to change some cast(ubyte*)s on those void[]s to uses of the .ptr property. 3) std.gc.hasNoPointers() is no longer needed; I removed all calls to it and removed the import. I haven't extensively tested correctness. However this patch is rather trivial, the changed code compiles and the unit test succeeds so I don't think I could've broken anything. --
Oct 08 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1557 ------- Comment #1 from fvbommel wxs.nl 2007-10-08 17:26 ------- Created an attachment (id=190) --> (http://d.puremagic.com/issues/attachment.cgi?id=190&action=view) The patch mentioned in the initial report. --
Oct 08 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1557 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from bugzilla digitalmars.com 2007-11-03 21:48 ------- Fixed dmd 1.023 and 2.007 --
Nov 03 2007