I am getting a memory leak and my EurekaLog is telling me that is it starting at the follow code. This following code is used to setup a Dymo Twin Label Printer.
So i'm guessing that since i'm creating them that i need to free them. Unfortunately there is no documentation (that i have been able to find) that tells me how to free them up. I've looked and found some stuff on "CreateOldObject" when opening applications like excel and word and all they do is Free and Unassigned the object but that wont work here ... (I know cus i tried it).
Does anyone have any suggestions as to how I free up this memory leak?
Code:
procedure DoPrepDymo;
begin //Create Dymo Label ActiveX objects.
try
DL := CreateOleObject(IDymoAddInName) as IDymoAddIn5;
DL2 := CreateOleObject(IDymoAddInName) as IDymoAddIn5;
LB := CreateOleObject(IDymoLabelsName) as IDymoLabels;
except
MessageDlg ('Unable to create Dymo Label ActiveX objects.', mtError, [mbOk], 0)
end;
// get the label files directory from Registry
with TRegistry.Create do begin
RootKey := HKEY_CURRENT_USER;
if OpenKey(sDirectoriesKey,FALSE) then begin
LabelDirName := ReadString(sLabelDirName);
CloseKey;
end
else LabelDirName := '';
end;
DL.Open(ExecDir+'SPCRReceipt2.LWL');
end;
So i'm guessing that since i'm creating them that i need to free them. Unfortunately there is no documentation (that i have been able to find) that tells me how to free them up. I've looked and found some stuff on "CreateOldObject" when opening applications like excel and word and all they do is Free and Unassigned the object but that wont work here ... (I know cus i tried it).
Does anyone have any suggestions as to how I free up this memory leak?