Are dispose methods missing?

Software: Away3D 4.x

synkarius, Member
Posted: 17 July 2012 08:25 PM   Total Posts: 64

Hi all.

I’ve only recently begun digging through the Away3D 4.0.0 source and I can’t seem to find dispose() methods on a lot of the classes. For example, NamedAssetBase has an empty disposeAsset() method, but SmoothSkeletonAnimator has nothing to override it with. That leaves an Array, two Vectors, and a SkeletonNaryLERPNode that never get disposed, not to mention all the stuff in the classes in between NamedAssetBase and SmoothSkeletonAnimator (SkeletonAnimatorBase and AnimatorBase).

Am I missing something here or are there just no dispose methods for a lot of classes?

   

Richard Olsson, Administrator
Posted: 17 July 2012 10:34 PM   Total Posts: 1192   [ # 1 ]

First of all, it seems like you are looking at old code, because there should no longer be a method called disposeAsset(). Go download the latest 4.0 “gold” version that we released today.

Furthermore, I think you might be overestimating the importance of explicit dispose methods. Because AS3 is a garbage collected language, and objects will hence be automatically disposed when they are no longer used, the only reason to have dispose methods is when you want to make it possible to explicitly dispose something immediately, or when there are resources allocated that would prevent proper garbage collection.

For this reason, we have dispose methods mainly on objects that allocate GPU resources, to allow you to free up those resources when you no longer need the object, as well as on objects that have large amounts of internal data so that you can quickly free up the memory otherwise used by that data.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X