Mika Raento wrote:
> Hello
>
> I get crashes in the destructor of Ndb depending a bit on how I declare
> variables in perl. I think perl doesn't have a deterministic destruction
> order by declaration order (since it does have reference counting). This
> means that calls like
>
> my $myNdb = new mysql::cluster::ndbapi::Ndb($connection, "mq_cluster");
So one thing I'm working on right now relates to this. I'm merging code
over from NDB/J, and one thing they do is create all new objects through
factory methods - even the Ndb_cluster_connection (adding an NdbFactory
with a static createNdbClusterConnection() method) I think that once all
of that is copied over, it should be easier to indicate to SWIG the
ownership and appropriate reference counting of things. So that would
become:
my $myNdb = $connection->getNdb("mq_cluster");
Actually, I think getNdb is already there. Then if we do need to put in
hints, it will be ones that tell SWIG that $connection owns $myNdb and
$connection can't be deleted before $myNdb... but I think SWIG will do
this naturally.
--
Monty Taylor
Senior Consultant
MySQL Inc., www.mysql.com
Get More with MySQL! www.mysql.com/consulting