Ignore:
Timestamp:
Apr 30, 2011, 12:24:57 AM (11 years ago)
Author:
Sam Hocevar
Message:

lisp: fix a memory leak in the grow stack objets and refactor the class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/lisp/lisp_gc.cpp

    r558 r561  
    3131
    3232// Stack where user programs can push data and have it GCed
    33 grow_stack<void> l_user_stack(150);
     33GrowStack<void> l_user_stack(150);
    3434
    3535// Stack of user pointers
    36 grow_stack<void *> PtrRef::stack(1500);
     36GrowStack<void *> PtrRef::stack(1500);
    3737
    3838static size_t reg_ptr_total = 0;
     
    187187void LispGC::CollectStacks()
    188188{
    189     size_t t = l_user_stack.son;
    190 
    191189    void **d = l_user_stack.sdata;
    192     for (size_t i = 0; i < t; i++, d++)
     190    for (size_t i = 0; i < l_user_stack.m_size; i++, d++)
    193191        *d = CollectObject((LObject *)*d);
    194192
    195     t = PtrRef::stack.son;
    196193    void ***d2 = PtrRef::stack.sdata;
    197     for (size_t i = 0; i < t; i++, d2++)
     194    for (size_t i = 0; i < PtrRef::stack.m_size; i++, d2++)
    198195    {
    199196        void **ptr = *d2;
     
    201198    }
    202199
    203     d2 = reg_ptr_list;
    204     for (size_t i = 0; i < reg_ptr_total; i++, d2++)
    205     {
    206         void **ptr = *d2;
     200    void ***d3 = reg_ptr_list;
     201    for (size_t i = 0; i < reg_ptr_total; i++, d3++)
     202    {
     203        void **ptr = *d3;
    207204        *ptr = CollectObject((LObject *)*ptr);
    208205    }
Note: See TracChangeset for help on using the changeset viewer.