Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_TopicIcon
Memory leak in TPsOPCGroup.OnDataChange
May 20, 2020
12:28, EEST
Avatar
konstantin.konnov
Member
Members
Forum Posts: 4
Member Since:
May 20, 2020
sp_UserOfflineSmall Offline

I use Sentrol673DC6Std for C++ Builder 6. I’ve tried to subscribe to the server items with this code below:

__fastcall Observer::Observer(const std::string &host, const std::string &serverId, int pollInterval, const
std::vector &items)
: TObject ()
, opcdaServer_ (new TPsOPCServer (0))
, group_ (new TPsOPCGroup (0))
{
opcdaServer_->Host = host.c_str ();
opcdaServer_->ServerName = AnsiString(serverId.c_str());
opcdaServer_->Log->Active = true;
opcdaServer_->Log->FileName = “file.log”;
opcdaServer_->Connect();
if (!opcdaServer_->Connected) {
std::cerr << "can’t connect" <Server = opcdaServer_;
group_->OnDataChange = onDataChanged;
group_->UpdateRate = 0;
group_->Async = true;
for (int i = 0; i AddItem (AnsiString(items[i].c_str()));
} catch (const Sysutils::Exception &e) {
std::cerr << e.Message.c_str() << std::endl;
}
}
}
}

void __fastcall Observer::onDataChanged (TObject *Sender, TPsOPCTransaction *tr)
{
std::cout << "here" << std::endl;
}

I see that I get into the onDataChanged, it is OK. But I also see that my application eats the memory from ~5 MB to 100 MB for one minute and continue to do it. What I do wrong?

May 20, 2020
17:24, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1029
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Answered by email – will get back here if something is revealed. Nothing apparently wrong with the code above.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 33
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 90
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 732
Moderators: 8
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1545
Posts: 6516
Newest Members:
mood edibles, LouieWreve, daniellabdx, janessan21, sammiebeak359, gena7127517, thorstenbouldin, Brett.Rollason, steven014223542, Roberthat
Moderators: Jouni Aro: 1029, Pyry: 1, Petri: 1, Bjarne Boström: 1045, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0, Elias: 0
Administrators: admin: 1