summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-01-09 03:39:08 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-01-09 03:39:08 +0000
commit2e9c610931b4e0a6bab25b1fe5dbd0def45ee126 (patch)
tree1c740e32afcfc6570b5e87d179c12854ea4f686c /sca-cpp/trunk/components
parentd2a4018d6c354a75e45800f90f45d09469bc4db5 (diff)
Fix memory leak in Python runtime integration. Reduce memory consumption of debug trace functions. Add trace points to help track the lifecycle of some of the runtime context objects.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1056880 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components')
-rw-r--r--sca-cpp/trunk/components/cache/memcache.hpp6
-rw-r--r--sca-cpp/trunk/components/chat/xmpp.hpp5
-rw-r--r--sca-cpp/trunk/components/filedb/filedb.hpp5
-rw-r--r--sca-cpp/trunk/components/log/scribe.hpp5
-rw-r--r--sca-cpp/trunk/components/nosqldb/tinycdb.hpp4
-rw-r--r--sca-cpp/trunk/components/queue/qpid.hpp8
-rw-r--r--sca-cpp/trunk/components/sqldb/pgsql.hpp5
-rw-r--r--sca-cpp/trunk/components/webservice/axis2.hpp4
8 files changed, 42 insertions, 0 deletions
diff --git a/sca-cpp/trunk/components/cache/memcache.hpp b/sca-cpp/trunk/components/cache/memcache.hpp
index a76af6b662..e4cdceb6fa 100644
--- a/sca-cpp/trunk/components/cache/memcache.hpp
+++ b/sca-cpp/trunk/components/cache/memcache.hpp
@@ -49,24 +49,30 @@ namespace memcache {
class MemCached {
public:
MemCached() : owner(false) {
+ debug("memcache::memcached");
}
MemCached(const string host, const int port) : owner(true) {
+ debug(host, "memcache::memcached::host");
+ debug(port, "memcache::memcached::port");
apr_pool_create(&pool, NULL);
apr_memcache_create(pool, 1, 0, &mc);
addServer(host, port);
}
MemCached(const list<string>& servers) : owner(true) {
+ debug(servers, "memcache::memcached::servers");
apr_pool_create(&pool, NULL);
apr_memcache_create(pool, 1, 0, &mc);
addServers(servers);
}
MemCached(const MemCached& c) : owner(false), pool(c.pool), mc(c.mc) {
+ debug("memcache::memcached::copy");
}
~MemCached() {
+ debug("memcache::~memcached");
if (!owner)
return;
apr_pool_destroy(pool);
diff --git a/sca-cpp/trunk/components/chat/xmpp.hpp b/sca-cpp/trunk/components/chat/xmpp.hpp
index 3a6aa86c5c..cafe342f05 100644
--- a/sca-cpp/trunk/components/chat/xmpp.hpp
+++ b/sca-cpp/trunk/components/chat/xmpp.hpp
@@ -45,11 +45,13 @@ namespace chat {
class XMPPRuntime {
public:
XMPPRuntime() {
+ debug("chat::xmppruntime");
xmpp_initialize();
log = xmpp_get_default_logger(XMPP_LEVEL_DEBUG);
}
~XMPPRuntime() {
+ debug("chat::~xmppruntime");
xmpp_shutdown();
}
@@ -67,12 +69,15 @@ public:
XMPPClient(const string& jid, const string& pass, bool owner = true) : owner(owner), ctx(xmpp_ctx_new(NULL, xmppRuntime.log)), conn(xmpp_conn_new(ctx)), connecting(false), connected(false), disconnecting(false) {
xmpp_conn_set_jid(conn, c_str(jid + "/" + mkuuid()));
xmpp_conn_set_pass(conn, c_str(pass));
+ debug(jid, "chat::xmppclient::jid");
}
XMPPClient(const XMPPClient& xc) : owner(false), ctx(xc.ctx), conn(xc.conn), listener(xc.listener), connecting(xc.connecting), connected(xc.connected), disconnecting(xc.disconnecting) {
+ debug("chat::xmppclient::copy");
}
~XMPPClient() {
+ debug("chat::~xmppclient");
extern const failable<bool> disconnect(XMPPClient& xc);
if (!owner)
return;
diff --git a/sca-cpp/trunk/components/filedb/filedb.hpp b/sca-cpp/trunk/components/filedb/filedb.hpp
index 89ff3b8157..39c8aff868 100644
--- a/sca-cpp/trunk/components/filedb/filedb.hpp
+++ b/sca-cpp/trunk/components/filedb/filedb.hpp
@@ -45,15 +45,20 @@ namespace filedb {
class FileDB {
public:
FileDB() : owner(false), jscx(*jscontext("")) {
+ debug("filedb::filedb");
}
FileDB(const string& name, const string& format) : owner(true), name(name), format(format), jscx(*jscontext(format)) {
+ debug(name, "filedb::filedb::name");
+ debug(format, "filedb::filedb::format");
}
FileDB(const FileDB& c) : owner(false), name(c.name), format(c.format), jscx(c.jscx) {
+ debug("filedb::filedb::copy");
}
~FileDB() {
+ debug("filedb::~filedb");
}
private:
diff --git a/sca-cpp/trunk/components/log/scribe.hpp b/sca-cpp/trunk/components/log/scribe.hpp
index 5237bd0183..1e0ce46511 100644
--- a/sca-cpp/trunk/components/log/scribe.hpp
+++ b/sca-cpp/trunk/components/log/scribe.hpp
@@ -65,18 +65,23 @@ namespace scribe {
class Scribe {
public:
Scribe() : owner(false) {
+ debug("scribe::scribe");
}
Scribe(const string host, const int port) : owner(true) {
+ debug(host, "scribe::scribe::host");
+ debug(port, "scribe::scribe::port");
init(host, port);
}
Scribe(const Scribe& c) : owner(false) {
+ debug("scribe::scribe::copy");
client = c.client;
transport = c.transport;
}
~Scribe() {
+ debug("scribe::~scribe");
if (!owner)
return;
try {
diff --git a/sca-cpp/trunk/components/nosqldb/tinycdb.hpp b/sca-cpp/trunk/components/nosqldb/tinycdb.hpp
index 0fab1a9854..e26001dc59 100644
--- a/sca-cpp/trunk/components/nosqldb/tinycdb.hpp
+++ b/sca-cpp/trunk/components/nosqldb/tinycdb.hpp
@@ -95,18 +95,22 @@ const bool free(const buffer&b) {
class TinyCDB {
public:
TinyCDB() : owner(false), fd(-1) {
+ debug("tinycdb::tinycdb");
st.st_ino = 0;
}
TinyCDB(const string& name) : owner(true), name(name), fd(-1) {
+ debug(name, "tinycdb::tinycdb::name");
st.st_ino = 0;
}
TinyCDB(const TinyCDB& c) : owner(false), name(c.name), fd(c.fd) {
+ debug("tinycdb::tinycdb::copy");
st.st_ino = c.st.st_ino;
}
~TinyCDB() {
+ debug("tinycdb::~tinycdb");
if (!owner)
return;
if (fd == -1)
diff --git a/sca-cpp/trunk/components/queue/qpid.hpp b/sca-cpp/trunk/components/queue/qpid.hpp
index 2651e3a433..4fb4c7a1bd 100644
--- a/sca-cpp/trunk/components/queue/qpid.hpp
+++ b/sca-cpp/trunk/components/queue/qpid.hpp
@@ -52,17 +52,21 @@ namespace queue {
class QpidConnection {
public:
QpidConnection() : owner(true) {
+ debug("queue::qpidonnection");
c.open("localhost", 5672);
}
QpidConnection(const bool owner) : owner(owner) {
+ debug("queue::qpidonnection");
c.open("localhost", 5672);
}
QpidConnection(const QpidConnection& qc) : owner(false), c(qc.c) {
+ debug("queue::qpidonnection::copy");
}
~QpidConnection() {
+ debug("queue::~qpidonnection");
if (!owner)
return;
c.close();
@@ -91,15 +95,19 @@ const failable<bool> close(QpidConnection& qc) {
class QpidSession {
public:
QpidSession(QpidConnection& qc) : owner(true), s(qc.c.newSession()) {
+ debug("queue::qpidsession");
}
QpidSession(QpidConnection& qc, const bool owner) : owner(owner), s(qc.c.newSession()) {
+ debug("queue::qpidsession");
}
QpidSession(const QpidSession& qs) : owner(false), s(qs.s) {
+ debug("queue::qpidsession::copy");
}
~QpidSession() {
+ debug("queue::~qpidsession");
if (!owner)
return;
s.close();
diff --git a/sca-cpp/trunk/components/sqldb/pgsql.hpp b/sca-cpp/trunk/components/sqldb/pgsql.hpp
index f4da8db220..7dca38b086 100644
--- a/sca-cpp/trunk/components/sqldb/pgsql.hpp
+++ b/sca-cpp/trunk/components/sqldb/pgsql.hpp
@@ -55,9 +55,12 @@ const string pgfailure(PGresult* r, PGconn* conn) {
class PGSql {
public:
PGSql() : owner(false) {
+ debug("pgsql::pgsql");
}
PGSql(const string& conninfo, const string& table) : owner(true), conn(NULL), conninfo(conninfo), table(table) {
+ debug(conninfo, "pgsql::pgsql::conninfo");
+ debug(table, "pgsql::pgsql::table");
conn = PQconnectdb(c_str(conninfo));
if (PQstatus(conn) != CONNECTION_OK) {
mkfailure<bool>(string("Could not connect to postgresql database: ") + PQerrorMessage(conn));
@@ -67,9 +70,11 @@ public:
}
PGSql(const PGSql& c) : owner(false), conn(c.conn), conninfo(c.conninfo), table(c.table) {
+ debug("pgsql::pgsql::copy");
}
~PGSql() {
+ debug("pgsql::~pgsql");
if (!owner)
return;
if (conn == NULL)
diff --git a/sca-cpp/trunk/components/webservice/axis2.hpp b/sca-cpp/trunk/components/webservice/axis2.hpp
index c2886edb71..47813ccd6d 100644
--- a/sca-cpp/trunk/components/webservice/axis2.hpp
+++ b/sca-cpp/trunk/components/webservice/axis2.hpp
@@ -58,15 +58,19 @@ namespace webservice {
class Axis2Context {
public:
Axis2Context() : env(axutil_env_create_all("axis2.log", AXIS2_LOG_LEVEL_WARNING)), owner(true) {
+ debug("webservice::axis2context");
}
Axis2Context(const Axis2Context& ax) : env(ax.env), owner(false) {
+ debug("webservice::axis2context::copy");
}
Axis2Context(const axutil_env_t* env) : env(const_cast<axutil_env_t*>(env)), owner(false) {
+ debug("webservice::axis2context::env");
}
~Axis2Context() {
+ debug("webservice::~axis2context");
if (!owner || env == NULL)
return;
axutil_env_free(env);