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

Changeset 5431

Show
Ignore:
Timestamp:
04/15/10 01:51:46 (2 years ago)
Author:
kris
Message:

fixes #1903 :: Objects are garbage collected despite being referenced from a HashSet?

big thank-you to dhasanan

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/util/container/Container.d

    r5418 r5431  
    130130                { 
    131131                        auto p = (cast(T**) calloc(count, (T*).sizeof)) [0 .. count]; 
    132                         GC.addRoot (cast(void*) p); 
     132                        GC.addRange (cast(void*) p, count * (T*).sizeof); 
    133133                        return p; 
    134134                } 
     
    144144                        if (t.ptr) 
    145145                           { 
    146                            GC.removeRoot (t.ptr); 
     146                           GC.removeRange (t.ptr); 
    147147                           free (t.ptr); 
    148148                           } 
     
    181181                           foreach (ref list; lists) 
    182182                                   { 
    183                                    GC.removeRoot (list.ptr); 
     183                                   GC.removeRange (list.ptr); 
    184184                                   free (list.ptr); 
    185185                                   list = null; 
     
    217217                        auto p = (cast(T*) calloc (chunks, T.sizeof)) [0 .. chunks]; 
    218218                        lists[$-1] = p; 
    219                         GC.addRoot (p.ptr); 
     219                        GC.addRange (p.ptr, T.sizeof * chunks); 
    220220                        auto head = cache; 
    221221                        foreach (ref node; p)