Hi there, I discovered a problem related to the VersionAttribute class while integrating the ptolemy kernel in one of our own applications. Our application creates a default workspace that is reused over the life-cycle of many executed models. Models are manually parsed from a MoML file and added to the workspace as seperate composite entities. After the model has been executed it is removed from the workspace. By printing a workspace directory list after the remove operation I discovered that the VersionAttribute that is contained by the model is not removed from the workspace. I don't know if Vergil creates a single workspace that is reused for every new model, but in our application this eventually leads to a out of memory exception.
The workspace remove operation discards all contained named objects by calling remove on the internal workspace directory list. However this operation fails for a VersionAttribute object. By analysing the equals method of this class I discovered that equals fails for a comparison between two identical object references: public boolean equals(Object obj) { // If the _tupleList is null, then we are not fully constructed. // I see no choice but to return false. if (_tupleList == null) { ---> return false; } if (obj instanceof VersionAttribute) { return (compareTo(obj) == 0); } return false; } Somehow the tupleList attribute does not exist during this call. I should mention that the VersionAttribute object was created by the MoMl parser and setExpression was applied under normal conditions. Therefore I cannot explain why tupleList is null. Maybe there is a clone method involved. However if it is correct that the tupleList attribute can be null under these conditions, the implemention of the equals method should be modified by calling equals on it's parent: public boolean equals(Object obj) { if (_tupleList == null) { ---> return super.equals(obj); } if (obj instanceof VersionAttribute) { return (compareTo(obj) == 0); } return false; } This provides a working solution to our problem. However the fact that tupleList can be null when parsed from a MoML file doesn't make any sense to me. Kind regards, Richard van der Laan / [L]uminis Email : [EMAIL PROTECTED] TheWeb: http://www.luminis.nl ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]