Updated Branches: refs/heads/master 10e8fc625 -> 86514a0f0
fixed memory leak in tstop Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/86514a0f Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/86514a0f Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/86514a0f Branch: refs/heads/master Commit: 86514a0f0573fdc4382a3c4da6b252456aaf7bc8 Parents: 10e8fc6 Author: Bryan Call <[email protected]> Authored: Wed May 23 15:14:03 2012 -0700 Committer: Bryan Call <[email protected]> Committed: Wed May 23 15:14:03 2012 -0700 ---------------------------------------------------------------------- contrib/tstop/src/stats.h | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/86514a0f/contrib/tstop/src/stats.h ---------------------------------------------------------------------- diff --git a/contrib/tstop/src/stats.h b/contrib/tstop/src/stats.h index 6f33cfc..4db4a0c 100644 --- a/contrib/tstop/src/stats.h +++ b/contrib/tstop/src/stats.h @@ -159,16 +159,14 @@ public: if (item.type == 1 || item.type == 2 || item.type == 5 || item.type == 8) { assert(TSRecordGetInt(item.name, &value) == TS_ERR_OKAY); - cerr << "name" << item.name << " value: " << value << endl; + //cerr << "name" << item.name << " value: " << value << endl; string key = item.name; char buffer[32]; sprintf(buffer, "%lld", value); string foo = buffer; (*_stats)[key] = foo; - - } - } + } _old_time = _now; _now = now; _time_diff = _now - _old_time; @@ -187,6 +185,8 @@ public: gettimeofday(&_time, NULL); double now = _time.tv_sec + (double)_time.tv_usec / 1000000; + response.clear(); + response.reserve(32768); // should hopefully be smaller then 32KB res = curl_easy_perform(curl); // only if success update stats and time information @@ -335,6 +335,15 @@ public: } } + ~Stats() { + if (_stats != NULL) { + delete _stats; + } + if (_old_stats != NULL) { + delete _old_stats; + } + } + private: map<string, string> *_stats; map<string, string> *_old_stats;
