Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1903 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Objects are garbage collected despite being referenced from a HashSet

Reported by: dhasenan Assigned to: kris
Priority: major Milestone: 1.0
Component: Tango Version: 0.99.9 Kai
Keywords: Cc:

Description

Essentially:

class Foo
{
   static HashSet!(Foo) allFoos;
   this () { allFoos.add(this); }
}

Make a few Foos, then try calling methods on them (by going through that HashSet?). You will get a segmentation fault at some point because they have been garbage collected.

It appears that the allocation routines in tango.util.container.Container are using GC.addRoot when they should be using GC.addRange. Patch attached.

Attachments

container.patch (1.6 kB) - added by dhasenan on 04/11/10 10:49:29.
nyu nyu-nyu!

Change History

04/11/10 10:49:29 changed by dhasenan

  • attachment container.patch added.

nyu nyu-nyu!

04/24/10 18:15:00 changed by kris

  • status changed from new to closed.
  • resolution set to fixed.