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
New Member
Members
Forum Posts: 1
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: 845
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: 267

Currently Online:
12 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 100

pramanj: 86

ibrahim: 69

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 36

Rainer Versteeg: 32

Thomas Reuther: 26

Member Stats:

Guest Posters: 0

Members: 1037

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 968

Posts: 4078

Newest Members:

NilsonChalie, markblue523, savannah3880, darrenyo, pokapoka95, roscoedomingo7, kathrinrohde588, aleidamott69222, mp, corinapzx0505

Moderators: Jouni Aro: 845, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 508, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 20, Markus Johansson: 15, Matti Siponen: 18, Lusetti: 0

Administrators: admin: 0