Archived
This forum has been archived. Please start a new discussion on GitHub.
Memory problem using dictionary or array as parameters
enrico
in Help Center
Hi all,
we have encountered a problem using dictionary or array as parameters.
We wrote a stress test with a client in C++ and a client in php.
Our slice definition is:
Our Server.cpp is:
Our implementation of FrameworkI.cpp is:
At the moment, our method Database::query is empty and only returns true.
Calling the method many times in a cycle, we are seeing an incredibile growth of memory usage. The growht is directly proportional to the size of the dictionary as parameter. We tried also to replace the dictionary with a simple array. The problem was the same.
After the test, the occupied memory never decreases.
What's wrong?
Thanks in advance for your time.
Best regards,
Enrico
P.S. We are using:
Ice-3.0.1 patched
gcc-4.0.3
libstlport4.6
Debian testing
we have encountered a problem using dictionary or array as parameters.
We wrote a stress test with a client in C++ and a client in php.
Our slice definition is:
...
dictionary<string, string> mapArray;
...
interface Framework
{
bool query(mapArray arrayConfig, string stringQuery, out recordSet myResult, out int recordNumber) throws MBException;
...
Our Server.cpp is:
class FMKServer : public Ice::Application
{
public:
virtual int run(int, char*[]);
};
int main(int argc, char* argv[])
{
FMKServer app;
return app.main(argc, argv, "config");
}
int FMKServer::run(int argc, char* argv[])
{
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Framework");
adapter->add(new FrameworkI, Ice::stringToIdentity("framework"));
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
Our implementation of FrameworkI.cpp is:
bool FrameworkI::query(const mapArray& arrayConfig, const string& stringQuery, recordSet& myResult, int& recordNumber, const Ice::Current&) throw (MBException)
{
IceUtil::Mutex::Lock lock(this->_mutex);
mapArray arrayTemp=arrayConfig;
Database db (arrayTemp["host"].c_str(),arrayTemp["loginDb"].c_str(),arrayTemp["passwordDb"].c_str(),arrayTemp["port"].c_str(),arrayTemp["dbName"].c_str(),arrayTemp["databaseType"].c_str());
try
{
db.query(stringQuery, myResult, recordNumber);
}
catch(exception ex)
{
cout << ex.what() << endl;
MBException mbe;
mbe.description=(string) ex.what();
mbe.class="Database";
mbe.method="query()";
throw mbe;
}
arrayTemp.clear();
return true;
};
At the moment, our method Database::query is empty and only returns true.
Calling the method many times in a cycle, we are seeing an incredibile growth of memory usage. The growht is directly proportional to the size of the dictionary as parameter. We tried also to replace the dictionary with a simple array. The problem was the same.
After the test, the occupied memory never decreases.
What's wrong?
Thanks in advance for your time.
Best regards,
Enrico
P.S. We are using:
Ice-3.0.1 patched
gcc-4.0.3
libstlport4.6
Debian testing
0
