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 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: 1026
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:
32 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1