Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Memory leak TPSOPCConnector
June 25, 2012
14:23, EEST
Avatar
Rainer Versteeg
Member
Members
Forum Posts: 32
Member Since:
March 21, 2012
sp_UserOfflineSmall Offline

Hello !

At runtime.

if Connector = nil then
Connector := TPSOPCConnector.create(nil)
else
begin
Connector.free;
Connector := TPSOPCConnector.create(nil);
end;

if client = nil then
client := TPsOPCServer.create(nil)
else
begin
client.free;
client := TPsOPCServer.create(nil);
end;

client.OnDisConnect := Client_KepwareDisconnect;
client.OnConnect := Client_KepwareConnect;
client.OnShutDown := Client_KepwareServerShutdown;
client.Host := mod_Application.OPCServerHostname;
IOL_Controller.OPC_CLIENT_STATE := 5;
IOL_Controller.OPC_CLIENT_STATE_T := ‘Connecting to: ‘ + client.Host;
client.servername := ‘DEMiC_OPC_SERVER_V100’;
client.UseCredentials := False;
client.OwnsGroups := true;
client.Log.FileName := ‘C:\Log1.txt’;
client.Log.Active := False;
client.OnError := ServerError;
client.OnStatusChange := nil; // PsOPCServer1StatusChange;
client.StatusInterval := 1000;
Connector.Clear;
FILL_GROUP1; // ADD Items to the Connector ca. 4000 Items.
Connector.AsyncRefreshInterval := 0;
Connector.OnError := PsOPCConnector1Error;
Connector.Async := true;
Connector.UpdateRate := 100;
Connector.Server := client;

try
client.Connect;
except
// Disconnect and Free[Memory increase]
Connector.Active := False;
Connector.Connected := False;
Connector.OPCGroup.Disconnect;
Connector.OPCGroup.Clear;
Connector.Server := nil;

if client.Connected then
client.Disconnect;
if Connector nil then
Connector.free;
if client nil then
freeandnil(client);
end;

How I must disconnect and Free the Items ?

Br,
Rainer

June 26, 2012
14:51, EEST
Avatar
Otso Palonen
Espoo, Finland
Moderator
Moderators
Forum Posts: 32
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi Rainer,

Connector owns the items and will free them itself once it is destructed.

Best regards,
– Otso

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

ibrahim: 75

rocket science: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 709

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1465

Posts: 6252

Newest Members:

christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer, shanonhumphreys, KupimotoblokfuB, tamhollander5, paulinafcf, bridgette18l

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 982, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 319, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1