On timer tick I am allocating new ClearCase ApplicationClass object, Is following code okay? Or Do I need to release memory, If yes, How? I am using ClearCase Interop of ccauto.dll, I believe ccauto.dll is unmanaged code, I am confused, am I supposed to release the memory or not?
Please advise.
private void timer1_Tick(object sender, EventArgs e)
{
try
{
IClearCase ccNew = new ApplicationClass();
CCVOB vob = ccNew.get_VOB(ClearCaseVOB);
ccNew = null;
}
catch
{
}
}
2 comments:
Once you "GET" a ClearCase.Application object programmatically, do you need to keep getting the object in CAL?
Once theClearCase.Application
object is obtained, it can be used to get other objects without having to create them again.
CAL ensures as best it can that CAL objects stay synchronized with the underlying ClearCase data, refreshing as necessary when invoking properties and methods.
However, the CAL objects can become invalid if someone deletes the underlying ClearCase data while a reference is still held by the CAL object.
Meaning: you could set a CCVOB
instance once and for all (unless you think the Vob will disappear... which should be a very rare event!)
I am not sure if CCVOB
implements Disposable
, but if it does, setting it to null explicitly would prevent it to be properly disposed.
So I would not recommend ccNew = null;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.