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

Ticket #1903: container.patch

File container.patch, 1.6 kB (added by dhasenan, 2 years ago)

nyu nyu-nyu!

  • Container.d

    old new  
    129129                T*[] allocate (size_t count) 
    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                } 
    135135         
     
    143143                {       
    144144                        if (t.ptr) 
    145145                           { 
    146                            GC.removeRoot (t.ptr); 
     146                           GC.removeRange (t.ptr); 
    147147                           free (t.ptr); 
    148148                           } 
    149149                } 
     
    180180                           { 
    181181                           foreach (ref list; lists) 
    182182                                   { 
    183                                    GC.removeRoot (list.ptr); 
     183                                   GC.removeRange (list.ptr); 
    184184                                   free (list.ptr); 
    185185                                   list = null; 
    186186                                   } 
     
    216216                        lists.length = lists.length + 1; 
    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) 
    222222                                {