Reputation: 1
Hi I'm a bit uncertain about good practice within IBM DOORS Attribute DXL when it comes to which resources to release?
// I believe the following is correct for assigning the value of a buffer to an attribute of type Text.
Buffer buff = create
buff = "hello"
delete(buff)
obj.attrDXLName = tempStringOf(buff)
delete(buff)
// strings - what is required?
// eg..
string s = "hello"
s = "hello world"
s = null
// Where I am navigating through links, I may be using the following
LinkRef myLinkRef = null
myLinkRef = ...
ModName_ otherModuleHandle = data(SourceVersion myLinkRef)
Module m = ...
delete(otherModuleHandle)
In Attribute DXL, Which handles are known to need to be free'd and whats the best way to release the resource. I've seen delete(otherModuleHandle) being used, but not sure how it works or why it is needed. I have a suspicion that DOORS DXL does some sort of reference counting in its memory model.
Any thoughts would be greatly appreciated.
Upvotes: 0
Views: 89
Reputation: 426
I think the code listed will throw several errors?
Example- you can't refer to a buffer after calling delete on that buffer (your line 3).
If you asking about freeing up resources, that's a good practice for attribute dxl (which needs to essentially run the code for each object in the module when the module opens / the attribute is refreshed) - however, I wouldn't bother with setting strings to null. I would clean up used buffers at the end of my script, and I might close open module handles depending on what I was doing with them. On the other hand, I might leave the module handles, especially if I'm opening it multiple other times, as I have occasionally bumped into issues with code that opens / closes modules repeatedly.
Upvotes: 0