------------------------------------------------------------ revno: 13639 revision-id: squid3@treenet.co.nz-20141016183710-bnjt888cutkhac55 parent: squid3@treenet.co.nz-20141009090000-b1hcqvi5pju5bryg committer: Amos Jeffries branch nick: 3.5 timestamp: Thu 2014-10-16 11:37:10 -0700 message: CBDATA: log memory leak situations when --enable-debug-cbdata CBDATA objects are supposed to be explicitly locked and unlocked by all users. The nominal 'owner' of the data is also supposed to mark it as invalid when unlocking its reference. If a CBDATA object reaches 0 locks and is still valid, it therefore follows that either the locking or invalidate has not been properly implemented. Now that we are migrating to CbcPointer usage instead of explicit lock/unlock macro calls we have started encountering these situations. Any object reporting a 'leak' must be investigated; a) perhapse RefCount is better? b) using CbcPointer consistently and invalidating correctly. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20141016183710-bnjt888cutkhac55 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: b696475a9dc62d2728b3ae252bfb74fdd18b6103 # timestamp: 2014-10-16 18:50:47 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20141009090000-\ # b1hcqvi5pju5bryg # # Begin patch === modified file 'src/cbdata.cc' --- src/cbdata.cc 2014-10-06 19:38:03 +0000 +++ src/cbdata.cc 2014-10-16 18:37:10 +0000 @@ -434,8 +434,15 @@ -- c->locks; - if (c->valid || c->locks) - return; + if (c->locks) + return; + + if (c->valid) { +#if USE_CBDATA_DEBUG + debugs(45, DBG_IMPORTANT, "CBDATA memory leak. cbdata=" << p << " " << file << ":" << line); +#endif + return; + } --cbdataCount;