Mark Johnson (johnson++at++vrlab.uccb.ns.ca)
Thu, 29 Sep 1994 17:10:00 -0300
We are using user data attached to nodes in our scene. To prevent
memory leaks, a UserDataDelete function is registered using pfDeleteFunc().
This Delete function counts the number of times it is called. The number
of times that user data are assigned is also counted. When pfDelete
is used to clear all the children of a scene, the registered user data
delete function is called only once for each child of the pfScene, and
not for any of their children. There is a large discrepancy between
the number of allocations of the user data, and the number of times the
delete function is called.
According to the man page on pfDelete,
it decrements the reference count of all pfObjects referenced by its
argument, and deletes those that have counts <= 0. However, this does
not appear to include their user defined data pointers!
We had to write code that would traverse the entire scene graph, and
delete the user data.
Why should this be so? The man pages do say that user data cannot be
reference counted, but I can handle this myself since it calls my function
to delete it!
Is this problem a problem with Performer? Or my code?
A second problem is that the delete function is often called with a NULL
object pointer forcing the function to check the validity of its argument
since pfGetUserData(NULL) crashes.
Mark Johnson
johnson++at++vrlab.uccb.ns.ca
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:34 PDT