FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GC problem?

 
Post new topic   Reply to topic     Forum Index -> PyD
View previous topic :: View next topic  
Author Message
christof



Joined: 09 Jan 2008
Posts: 7
Location: Hamburg/ Germany

PostPosted: Fri Feb 08, 2008 2:48 am    Post subject: GC problem? Reply with quote

I am a beginner with D and celerid, so forgive if this seems to be a stupid question.

I am trying to wrap a tree structure to python. Each tree node can hold a couple of childs. It works, when a python reference to each node exists, but crashes otherwise.

Lets say:
Code:
    subexpr1 = dtables.Equal(0)       
    subexpr2 = dtables.In([2,3, 4])
    expr1 = dtables.Or(subexpr1, subexpr2)   
    expr2 = dtables.Or(dtables.Equal(0), dtables.In([2,3, 4]))


So for expr1 there python references to the child nodes exist, for expr2 not.

The node definition is as
Code:
class In : Expression
{
    PyObject* set;
   
    this(PyObject* value)
    {
        this.set = PySet_New(value);
        Py_INCREF(this.set);
    }

    bit eval_row(Table table, int position)
    {
        if (PySet_Contains(set, table[position]))
            return true;
        else
            return false;
    }
}
   


Expr1 works, whereas for expr2 an Access Violation occures. I think this is a problem related to garbage collection. What can I do?

Thanks,
Christof
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> PyD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group