diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2019-06-27 10:57:34 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2020-03-25 18:44:04 -0400 |
commit | 2902f23a4193d93c2e96daa45587a8c597c0a831 (patch) | |
tree | 96655824fd61c58335a388418b3a9147a1ce80fc /indra/llcorehttp/tests | |
parent | 3a7d40136415fbf1897d5240ef4e4d48f79c8a26 (diff) |
DRTVWR-476: Remove special llcorehttp test memory manager.
NickyD discovered that the substitute default allocator used for llcorehttp
tests was returning badly-aligned storage, which caused access violations on
alignment-sensitive data such as std::atomic. Thanks Nicky!!
Moreover, the llcorehttp test assertions regarding memory usage, well-
intentioned though they are, have been causing us trouble for years. Many have
already been disabled.
The problem is that use of test_allocator.h affected *everything* defined with
that header file's declarations visible. That inevitably included specific
functions in other subsystems. Those functions then (unintentionally) consumed
the special allocator, throwing off the memory tracking and making certain
memory-related assertions consistently fail.
This is a particular, observable bad effect of One Definition Rule violations.
Within a given program, C++ allows multiple definitions for the same entity,
but requires that all such definitions be the same. Partial visibility of the
global operator new() and operator delete() overrides meant that some
definitions of certain entities used the default global allocator, some used
llcorehttp's. There may have been other, more subtle bad effects of these ODR
violations.
If one wanted to reimplement verification of the memory consumption of
llcorehttp classes:
* Each llcorehttp class (for which memory tracking was desired) should declare
class-specific operator new() and operator delete() methods. Naturally,
these would all consume a central llcorehttp-specific allocator, but that
allocator should *not* be named global operator new().
* Presumably that would require runtime indirection to allow using the default
allocator in production while substituting the special allocator for tests.
* Recording and verifying the memory consumption in each test should be
performed in the test-object constructor and destructor, rather than being
sprinkled throughout the test<n>() methods.
* With that mechanism in place, the test object should provide methods to
adjust (or entirely disable) memory verification for a particular test.
* The test object should also provide a "yes, we're still consuming llcorehttp
memory" method to be used for spot checks in the middle of tests -- instead
of sprinkling in explicit comparisons as before.
* In fact, the llcorehttp test object in each test_*.hpp file should be
derived from a central llcorehttp test-object base class providing those
methods.
Diffstat (limited to 'indra/llcorehttp/tests')
-rw-r--r-- | indra/llcorehttp/tests/test_allocator.h | 2 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_bufferarray.hpp | 52 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_bufferstream.hpp | 52 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_httpheaders.hpp | 40 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_httpoperation.hpp | 26 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_httprequest.hpp | 215 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_httprequestqueue.hpp | 31 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_refcounted.hpp | 37 |
8 files changed, 12 insertions, 443 deletions
diff --git a/indra/llcorehttp/tests/test_allocator.h b/indra/llcorehttp/tests/test_allocator.h index 74bd294e47..abd88f4c98 100644 --- a/indra/llcorehttp/tests/test_allocator.h +++ b/indra/llcorehttp/tests/test_allocator.h @@ -30,6 +30,8 @@ #include <cstdlib> #include <new> +#error 2019-06-27 Do not use test_allocator.h -- does not respect alignment. + size_t GetMemTotal(); void * operator new(std::size_t size); //throw (std::bad_alloc); void * operator new[](std::size_t size); //throw (std::bad_alloc); diff --git a/indra/llcorehttp/tests/test_bufferarray.hpp b/indra/llcorehttp/tests/test_bufferarray.hpp index 8a2a64d970..cc4ad2a906 100644 --- a/indra/llcorehttp/tests/test_bufferarray.hpp +++ b/indra/llcorehttp/tests/test_bufferarray.hpp @@ -30,8 +30,6 @@ #include <iostream> -#include "test_allocator.h" - using namespace LLCore; @@ -44,7 +42,6 @@ struct BufferArrayTestData { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; }; typedef test_group<BufferArrayTestData> BufferArrayTestGroupType; @@ -56,13 +53,9 @@ void BufferArrayTestObjectType::test<1>() { set_test_name("BufferArray construction"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); ensure("One ref on construction of BufferArray", ba->getRefCount() == 1); - ensure("Memory being used", mMemTotal < GetMemTotal()); ensure("Nothing in BA", 0 == ba->size()); // Try to read @@ -72,9 +65,6 @@ void BufferArrayTestObjectType::test<1>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -82,9 +72,6 @@ void BufferArrayTestObjectType::test<2>() { set_test_name("BufferArray single write"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -105,9 +92,6 @@ void BufferArrayTestObjectType::test<2>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } @@ -116,9 +100,6 @@ void BufferArrayTestObjectType::test<3>() { set_test_name("BufferArray multiple writes"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -154,9 +135,6 @@ void BufferArrayTestObjectType::test<3>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -164,9 +142,6 @@ void BufferArrayTestObjectType::test<4>() { set_test_name("BufferArray overwriting"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -208,9 +183,6 @@ void BufferArrayTestObjectType::test<4>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -218,9 +190,6 @@ void BufferArrayTestObjectType::test<5>() { set_test_name("BufferArray multiple writes - sequential reads"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -255,9 +224,6 @@ void BufferArrayTestObjectType::test<5>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -265,9 +231,6 @@ void BufferArrayTestObjectType::test<6>() { set_test_name("BufferArray overwrite spanning blocks and appending"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -306,9 +269,6 @@ void BufferArrayTestObjectType::test<6>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure("All memory released", mMemTotal == GetMemTotal()); } template <> template <> @@ -316,9 +276,6 @@ void BufferArrayTestObjectType::test<7>() { set_test_name("BufferArray overwrite spanning blocks and sequential writes"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -371,9 +328,6 @@ void BufferArrayTestObjectType::test<7>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure("All memory released", mMemTotal == GetMemTotal()); } template <> template <> @@ -381,9 +335,6 @@ void BufferArrayTestObjectType::test<8>() { set_test_name("BufferArray zero-length appendBufferAlloc"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArray * ba = new BufferArray(); @@ -421,9 +372,6 @@ void BufferArrayTestObjectType::test<8>() // release the implicit reference, causing the object to be released ba->release(); - - // make sure we didn't leak any memory - ensure("All memory released", mMemTotal == GetMemTotal()); } } // end namespace tut diff --git a/indra/llcorehttp/tests/test_bufferstream.hpp b/indra/llcorehttp/tests/test_bufferstream.hpp index 831c901b9d..2739a6e38e 100644 --- a/indra/llcorehttp/tests/test_bufferstream.hpp +++ b/indra/llcorehttp/tests/test_bufferstream.hpp @@ -30,7 +30,6 @@ #include <iostream> -#include "test_allocator.h" #include "llsd.h" #include "llsdserialize.h" @@ -45,7 +44,6 @@ struct BufferStreamTestData { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; }; typedef test_group<BufferStreamTestData> BufferStreamTestGroupType; @@ -59,12 +57,8 @@ void BufferStreamTestObjectType::test<1>() { set_test_name("BufferArrayStreamBuf construction with NULL BufferArray"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(NULL); - ensure("Memory being used", mMemTotal < GetMemTotal()); // Not much will work with a NULL ensure("underflow() on NULL fails", tst_traits_t::eof() == bsb->underflow()); @@ -78,9 +72,6 @@ void BufferStreamTestObjectType::test<1>() // release the implicit reference, causing the object to be released delete bsb; bsb = NULL; - - // make sure we didn't leak any memory - ensure("Allocated memory returned", mMemTotal == GetMemTotal()); } @@ -89,12 +80,8 @@ void BufferStreamTestObjectType::test<2>() { set_test_name("BufferArrayStream construction with NULL BufferArray"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference BufferArrayStream * bas = new BufferArrayStream(NULL); - ensure("Memory being used", mMemTotal < GetMemTotal()); // Not much will work with a NULL here ensure("eof() is false on NULL", ! bas->eof()); @@ -104,9 +91,6 @@ void BufferStreamTestObjectType::test<2>() // release the implicit reference, causing the object to be released delete bas; bas = NULL; - - // make sure we didn't leak any memory - ensure("Allocated memory returned", mMemTotal == GetMemTotal()); } @@ -115,13 +99,9 @@ void BufferStreamTestObjectType::test<3>() { set_test_name("BufferArrayStreamBuf construction with empty BufferArray"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted BufferArray with implicit reference BufferArray * ba = new BufferArray; BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba); - ensure("Memory being used", mMemTotal < GetMemTotal()); // I can release my ref on the BA ba->release(); @@ -130,9 +110,6 @@ void BufferStreamTestObjectType::test<3>() // release the implicit reference, causing the object to be released delete bsb; bsb = NULL; - - // make sure we didn't leak any memory - ensure("Allocated memory returned", mMemTotal == GetMemTotal()); } @@ -141,24 +118,17 @@ void BufferStreamTestObjectType::test<4>() { set_test_name("BufferArrayStream construction with empty BufferArray"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted BufferArray with implicit reference BufferArray * ba = new BufferArray; { // create a new ref counted object with an implicit reference BufferArrayStream bas(ba); - ensure("Memory being used", mMemTotal < GetMemTotal()); } // release the implicit reference, causing the object to be released ba->release(); ba = NULL; - - // make sure we didn't leak any memory - ensure("Allocated memory returned", mMemTotal == GetMemTotal()); } @@ -167,9 +137,6 @@ void BufferStreamTestObjectType::test<5>() { set_test_name("BufferArrayStreamBuf construction with real BufferArray"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted BufferArray with implicit reference BufferArray * ba = new BufferArray; const char * content("This is a string. A fragment."); @@ -178,7 +145,6 @@ void BufferStreamTestObjectType::test<5>() // Creat an adapter for the BufferArray BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba); - ensure("Memory being used", mMemTotal < GetMemTotal()); // I can release my ref on the BA ba->release(); @@ -206,9 +172,6 @@ void BufferStreamTestObjectType::test<5>() // release the implicit reference, causing the object to be released delete bsb; bsb = NULL; - - // make sure we didn't leak any memory - ensure("Allocated memory returned", mMemTotal == GetMemTotal()); } @@ -217,9 +180,6 @@ void BufferStreamTestObjectType::test<6>() { set_test_name("BufferArrayStream construction with real BufferArray"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted BufferArray with implicit reference BufferArray * ba = new BufferArray; //const char * content("This is a string. A fragment."); @@ -229,7 +189,6 @@ void BufferStreamTestObjectType::test<6>() { // Creat an adapter for the BufferArray BufferArrayStream bas(ba); - ensure("Memory being used", mMemTotal < GetMemTotal()); // Basic operations bas << "Hello" << 27 << "."; @@ -243,10 +202,6 @@ void BufferStreamTestObjectType::test<6>() // release the implicit reference, causing the object to be released ba->release(); ba = NULL; - - // make sure we didn't leak any memory - // ensure("Allocated memory returned", mMemTotal == GetMemTotal()); - // static U64 mem = GetMemTotal(); } @@ -255,16 +210,12 @@ void BufferStreamTestObjectType::test<7>() { set_test_name("BufferArrayStream with LLSD serialization"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted BufferArray with implicit reference BufferArray * ba = new BufferArray; { // Creat an adapter for the BufferArray BufferArrayStream bas(ba); - ensure("Memory being used", mMemTotal < GetMemTotal()); // LLSD LLSD llsd = LLSD::emptyMap(); @@ -292,9 +243,6 @@ void BufferStreamTestObjectType::test<7>() // release the implicit reference, causing the object to be released ba->release(); ba = NULL; - - // make sure we didn't leak any memory - // ensure("Allocated memory returned", mMemTotal == GetMemTotal()); } diff --git a/indra/llcorehttp/tests/test_httpheaders.hpp b/indra/llcorehttp/tests/test_httpheaders.hpp index c05f1d9429..6aefb5054b 100644 --- a/indra/llcorehttp/tests/test_httpheaders.hpp +++ b/indra/llcorehttp/tests/test_httpheaders.hpp @@ -30,8 +30,6 @@ #include <iostream> -#include "test_allocator.h" - using namespace LLCoreInt; @@ -43,7 +41,6 @@ struct HttpHeadersTestData { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; }; typedef test_group<HttpHeadersTestData> HttpHeadersTestGroupType; @@ -55,19 +52,12 @@ void HttpHeadersTestObjectType::test<1>() { set_test_name("HttpHeaders construction"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders()); - ensure("Memory being used", mMemTotal < GetMemTotal()); ensure("Nothing in headers", 0 == headers->size()); // release the implicit reference, causing the object to be released headers.reset(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -75,9 +65,6 @@ void HttpHeadersTestObjectType::test<2>() { set_test_name("HttpHeaders construction"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders()); @@ -101,9 +88,6 @@ void HttpHeadersTestObjectType::test<2>() // release the implicit reference, causing the object to be released headers.reset(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -111,9 +95,6 @@ void HttpHeadersTestObjectType::test<3>() { set_test_name("HttpHeaders basic find"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders()); @@ -151,9 +132,6 @@ void HttpHeadersTestObjectType::test<3>() // release the implicit reference, causing the object to be released headers.reset(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -161,9 +139,6 @@ void HttpHeadersTestObjectType::test<4>() { set_test_name("HttpHeaders normalized header entry"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders()); @@ -251,9 +226,6 @@ void HttpHeadersTestObjectType::test<4>() // release the implicit reference, causing the object to be released headers.reset(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } // Verify forward iterator finds everything as expected @@ -262,9 +234,6 @@ void HttpHeadersTestObjectType::test<5>() { set_test_name("HttpHeaders iterator tests"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders()); @@ -337,9 +306,6 @@ void HttpHeadersTestObjectType::test<5>() // release the implicit reference, causing the object to be released headers.reset(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } // Reverse iterators find everything as expected @@ -348,9 +314,6 @@ void HttpHeadersTestObjectType::test<6>() { set_test_name("HttpHeaders reverse iterator tests"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders()); @@ -421,9 +384,6 @@ void HttpHeadersTestObjectType::test<6>() // release the implicit reference, causing the object to be released headers.reset(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } } // end namespace tut diff --git a/indra/llcorehttp/tests/test_httpoperation.hpp b/indra/llcorehttp/tests/test_httpoperation.hpp index e7df2337de..c6407e8d04 100644 --- a/indra/llcorehttp/tests/test_httpoperation.hpp +++ b/indra/llcorehttp/tests/test_httpoperation.hpp @@ -31,8 +31,6 @@ #include <iostream> -#include "test_allocator.h" - using namespace LLCoreInt; @@ -60,7 +58,6 @@ namespace tut { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; }; typedef test_group<HttpOperationTestData> HttpOperationTestGroupType; @@ -72,19 +69,12 @@ namespace tut { set_test_name("HttpOpNull construction"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpOperation::ptr_t op (new HttpOpNull()); ensure(op.use_count() == 1); - ensure(mMemTotal < GetMemTotal()); - - // release the implicit reference, causing the object to be released - op.reset(); - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); + // release the implicit reference, causing the object to be released + op.reset(); } template <> template <> @@ -92,9 +82,6 @@ namespace tut { set_test_name("HttpOpNull construction with handlers"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // Get some handlers LLCore::HttpHandler::ptr_t h1 (new TestHandler()); @@ -109,13 +96,10 @@ namespace tut // release the reference, releasing the operation but // not the handlers. - op.reset(); - ensure(mMemTotal != GetMemTotal()); - - // release the handlers - h1.reset(); + op.reset(); - ensure(mMemTotal == GetMemTotal()); + // release the handlers + h1.reset(); } } diff --git a/indra/llcorehttp/tests/test_httprequest.hpp b/indra/llcorehttp/tests/test_httprequest.hpp index e65588e48f..3cdd17919d 100644 --- a/indra/llcorehttp/tests/test_httprequest.hpp +++ b/indra/llcorehttp/tests/test_httprequest.hpp @@ -39,7 +39,6 @@ #include <boost/regex.hpp> #include <sstream> -#include "test_allocator.h" #include "llcorehttp_test.h" @@ -75,7 +74,6 @@ struct HttpRequestTestData { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; int mHandlerCalls; HttpStatus mStatus; }; @@ -196,27 +194,19 @@ void HttpRequestTestObjectType::test<1>() HttpRequest * req = NULL; - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - try { // Get singletons created HttpRequest::createService(); - + // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory being used", mMemTotal < GetMemTotal()); - + // release the request object delete req; req = NULL; HttpRequest::destroyService(); - - // make sure we didn't leak any memory - // nat 2017-08-15 don't: requires total stasis in every other subsystem -// ensure("Memory returned", mMemTotal == GetMemTotal()); } catch (...) { @@ -235,9 +225,6 @@ void HttpRequestTestObjectType::test<2>() HttpRequest * req = NULL; - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - try { // Get singletons created @@ -245,7 +232,6 @@ void HttpRequestTestObjectType::test<2>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory being used", mMemTotal < GetMemTotal()); // Issue a NoOp HttpHandle handle = req->requestNoOp(LLCore::HttpHandler::ptr_t()); @@ -255,17 +241,11 @@ void HttpRequestTestObjectType::test<2>() delete req; req = NULL; - // We're still holding onto the operation which is - // sitting, unserviced, on the request queue so... - ensure("Memory being used 2", mMemTotal < GetMemTotal()); - // Request queue should have two references: global singleton & service object ensure("Two references to request queue", 2 == HttpRequestQueue::instanceOf()->getRefCount()); // Okay, tear it down HttpRequest::destroyService(); - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory returned", mMemTotal == GetMemTotal()); } catch (...) { @@ -293,9 +273,6 @@ void HttpRequestTestObjectType::test<3>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -311,7 +288,6 @@ void HttpRequestTestObjectType::test<3>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a NoOp HttpHandle handle = req->requestNoOp(handlerp); @@ -360,8 +336,6 @@ void HttpRequestTestObjectType::test<3>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); } catch (...) { @@ -386,9 +360,6 @@ void HttpRequestTestObjectType::test<4>() LLCore::HttpHandler::ptr_t handler1p(&handler1, NoOpDeletor); LLCore::HttpHandler::ptr_t handler2p(&handler2, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req1 = NULL; @@ -407,7 +378,6 @@ void HttpRequestTestObjectType::test<4>() // create a new ref counted object with an implicit reference req1 = new HttpRequest(); req2 = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue some NoOps HttpHandle handle = req1->requestNoOp(handler1p); @@ -466,8 +436,6 @@ void HttpRequestTestObjectType::test<4>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 3 == mHandlerCalls); - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); } catch (...) { @@ -491,9 +459,6 @@ void HttpRequestTestObjectType::test<5>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -509,7 +474,6 @@ void HttpRequestTestObjectType::test<5>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a Spin HttpHandle handle = req->requestSpin(1); @@ -535,15 +499,6 @@ void HttpRequestTestObjectType::test<5>() // Shut down service HttpRequest::destroyService(); - - // Check memory usage - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); - // This memory test should work but could give problems as it - // relies on the worker thread picking up a friendly request - // to shutdown. Doing so, it drops references to things and - // we should go back to where we started. If it gives you - // problems, look into the code before commenting things out. } catch (...) { @@ -566,9 +521,6 @@ void HttpRequestTestObjectType::test<6>() // references to it after completion of this method. // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -586,7 +538,6 @@ void HttpRequestTestObjectType::test<6>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a Spin HttpHandle handle = req->requestSpin(0); // Hard spin @@ -612,13 +563,6 @@ void HttpRequestTestObjectType::test<6>() // Shut down service HttpRequest::destroyService(); - - // Check memory usage - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - // ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); - // This memory test won't work because we're killing the thread - // hard with the hard spinner. There's no opportunity to join - // nicely so many things leak or get destroyed unilaterally. } catch (...) { @@ -643,9 +587,6 @@ void HttpRequestTestObjectType::test<7>() TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -662,7 +603,6 @@ void HttpRequestTestObjectType::test<7>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); opts = HttpOptions::ptr_t(new HttpOptions()); opts->setRetries(1); // Don't try for too long - default retries take about 18S @@ -726,14 +666,6 @@ void HttpRequestTestObjectType::test<7>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can't do this on any platform anymore, the LL logging system holds - // on to memory and produces what looks like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -761,9 +693,6 @@ void HttpRequestTestObjectType::test<8>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -779,7 +708,6 @@ void HttpRequestTestObjectType::test<8>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a GET that *can* connect mStatus = HttpStatus(200); @@ -835,15 +763,6 @@ void HttpRequestTestObjectType::test<8>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can only do this memory test on Windows. On other platforms, - // the LL logging system holds on to memory and produces what looks - // like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -870,9 +789,6 @@ void HttpRequestTestObjectType::test<9>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -888,7 +804,6 @@ void HttpRequestTestObjectType::test<9>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a GET that *can* connect mStatus = HttpStatus(200); @@ -946,15 +861,6 @@ void HttpRequestTestObjectType::test<9>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can only do this memory test on Windows. On other platforms, - // the LL logging system holds on to memory and produces what looks - // like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -981,9 +887,6 @@ void HttpRequestTestObjectType::test<10>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1000,7 +903,6 @@ void HttpRequestTestObjectType::test<10>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a GET that *can* connect static const char * body_text("Now is the time for all good men..."); @@ -1063,14 +965,6 @@ void HttpRequestTestObjectType::test<10>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can't do this on any platform anymore, the LL logging system holds - // on to memory and produces what looks like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -1100,9 +994,6 @@ void HttpRequestTestObjectType::test<11>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1119,7 +1010,6 @@ void HttpRequestTestObjectType::test<11>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a GET that *can* connect static const char * body_text("Now is the time for all good men..."); @@ -1182,15 +1072,6 @@ void HttpRequestTestObjectType::test<11>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can only do this memory test on Windows. On other platforms, - // the LL logging system holds on to memory and produces what looks - // like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -1220,9 +1101,6 @@ void HttpRequestTestObjectType::test<12>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1241,7 +1119,6 @@ void HttpRequestTestObjectType::test<12>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a GET that *can* connect mStatus = HttpStatus(200); @@ -1299,14 +1176,6 @@ void HttpRequestTestObjectType::test<12>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can't do this on any platform anymore, the LL logging system holds - // on to memory and produces what looks like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -1338,9 +1207,6 @@ void HttpRequestTestObjectType::test<13>() TestHandler2 handler(this, "handler"); handler.mHeadersRequired.reserve(20); // Avoid memory leak test failure LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1360,7 +1226,6 @@ void HttpRequestTestObjectType::test<13>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); opts = HttpOptions::ptr_t(new HttpOptions()); opts->setWantHeaders(true); @@ -1428,15 +1293,6 @@ void HttpRequestTestObjectType::test<13>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can only do this memory test on Windows. On other platforms, - // the LL logging system holds on to memory and produces what looks - // like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -1462,9 +1318,6 @@ void HttpRequestTestObjectType::test<14>() TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); std::string url_base(get_base_url() + "/sleep/"); // path to a 30-second sleep - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1481,7 +1334,6 @@ void HttpRequestTestObjectType::test<14>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); opts = HttpOptions::ptr_t(new HttpOptions); opts->setRetries(0); // Don't retry @@ -1546,14 +1398,6 @@ void HttpRequestTestObjectType::test<14>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can't do this on any platform anymore, the LL logging system holds - // on to memory and produces what looks like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -1586,9 +1430,6 @@ void HttpRequestTestObjectType::test<15>() // for memory return tests. handler.mCheckContentType = "application/llsd+xml"; handler.mCheckContentType.clear(); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1604,7 +1445,6 @@ void HttpRequestTestObjectType::test<15>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // Issue a GET that *can* connect mStatus = HttpStatus(200); @@ -1662,15 +1502,6 @@ void HttpRequestTestObjectType::test<15>() HttpRequest::destroyService(); ensure("Two handler calls on the way out", 2 == mHandlerCalls); - -#if 0 // defined(WIN32) - // Can only do this memory test on Windows. On other platforms, - // the LL logging system holds on to memory and produces what looks - // like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -1701,9 +1532,6 @@ void HttpRequestTestObjectType::test<16>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -1943,9 +1771,6 @@ void HttpRequestTestObjectType::test<17>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -2131,9 +1956,6 @@ void HttpRequestTestObjectType::test<18>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -2320,9 +2142,6 @@ void HttpRequestTestObjectType::test<19>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -2503,9 +2322,6 @@ void HttpRequestTestObjectType::test<20>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -2711,9 +2527,6 @@ void HttpRequestTestObjectType::test<21>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -2915,9 +2728,6 @@ void HttpRequestTestObjectType::test<22>() // Create before memory record as the string copy will bump numbers. TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpOptions::ptr_t options; @@ -2939,7 +2749,6 @@ void HttpRequestTestObjectType::test<22>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); // ====================================== // Issue bug2295 GETs that will get a 206 @@ -3073,14 +2882,6 @@ void HttpRequestTestObjectType::test<22>() // Shut down service HttpRequest::destroyService(); - -#if 0 // defined(WIN32) - // Can't do this on any platform anymore, the LL logging system holds - // on to memory and produces what looks like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { @@ -3117,9 +2918,6 @@ void HttpRequestTestObjectType::test<23>() TestHandler2 handler(this, "handler"); LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); std::string url_base(get_base_url() + "/503/"); // path to 503 generators - - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); mHandlerCalls = 0; HttpRequest * req = NULL; @@ -3136,7 +2934,6 @@ void HttpRequestTestObjectType::test<23>() // create a new ref counted object with an implicit reference req = new HttpRequest(); - ensure("Memory allocated on construction", mMemTotal < GetMemTotal()); opts = HttpOptions::ptr_t(new HttpOptions()); opts->setRetries(1); // Retry once only @@ -3210,14 +3007,6 @@ void HttpRequestTestObjectType::test<23>() // Shut down service HttpRequest::destroyService(); - -#if 0 // defined(WIN32) - // Can't do this on any platform anymore, the LL logging system holds - // on to memory and produces what looks like memory leaks... - - // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal()); - ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal()); -#endif } catch (...) { diff --git a/indra/llcorehttp/tests/test_httprequestqueue.hpp b/indra/llcorehttp/tests/test_httprequestqueue.hpp index ef4ce0479b..dba9e0b250 100644 --- a/indra/llcorehttp/tests/test_httprequestqueue.hpp +++ b/indra/llcorehttp/tests/test_httprequestqueue.hpp @@ -30,7 +30,6 @@ #include <iostream> -#include "test_allocator.h" #include "_httpoperation.h" @@ -45,7 +44,6 @@ struct HttpRequestqueueTestData { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; }; typedef test_group<HttpRequestqueueTestData> HttpRequestqueueTestGroupType; @@ -57,20 +55,13 @@ void HttpRequestqueueTestObjectType::test<1>() { set_test_name("HttpRequestQueue construction"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpRequestQueue::init(); ensure("One ref on construction of HttpRequestQueue", HttpRequestQueue::instanceOf()->getRefCount() == 1); - ensure("Memory being used", mMemTotal < GetMemTotal()); // release the implicit reference, causing the object to be released HttpRequestQueue::term(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -78,9 +69,6 @@ void HttpRequestqueueTestObjectType::test<2>() { set_test_name("HttpRequestQueue refcount works"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpRequestQueue::init(); @@ -91,13 +79,9 @@ void HttpRequestqueueTestObjectType::test<2>() HttpRequestQueue::term(); ensure("One ref after term() called", rq->getRefCount() == 1); - ensure("Memory being used", mMemTotal < GetMemTotal()); // Drop ref rq->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -105,9 +89,6 @@ void HttpRequestqueueTestObjectType::test<3>() { set_test_name("HttpRequestQueue addOp/fetchOp work"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpRequestQueue::init(); @@ -126,9 +107,6 @@ void HttpRequestqueueTestObjectType::test<3>() // release the singleton, hold on to the object HttpRequestQueue::term(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -136,9 +114,6 @@ void HttpRequestqueueTestObjectType::test<4>() { set_test_name("HttpRequestQueue addOp/fetchAll work"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference HttpRequestQueue::init(); @@ -164,9 +139,6 @@ void HttpRequestqueueTestObjectType::test<4>() // release the singleton, hold on to the object HttpRequestQueue::term(); - - // We're still holding onto the ops. - ensure(mMemTotal < GetMemTotal()); // Release them ops.clear(); @@ -177,9 +149,6 @@ void HttpRequestqueueTestObjectType::test<4>() // op->release(); // } } - - // Should be clean - ensure("All memory returned", mMemTotal == GetMemTotal()); } } // end namespace tut diff --git a/indra/llcorehttp/tests/test_refcounted.hpp b/indra/llcorehttp/tests/test_refcounted.hpp index 5dff143e5d..2310812d5a 100644 --- a/indra/llcorehttp/tests/test_refcounted.hpp +++ b/indra/llcorehttp/tests/test_refcounted.hpp @@ -28,9 +28,8 @@ #include "_refcounted.h" -#include "test_allocator.h" - -#if 0 // disable all of this because it's hanging win64 builds? +// disable all of this because it's hanging win64 builds? +#if ! (LL_WINDOWS && ADDRESS_SIZE == 64) using namespace LLCoreInt; namespace tut @@ -39,7 +38,6 @@ namespace tut { // the test objects inherit from this so the member functions and variables // can be referenced directly inside of the test functions. - size_t mMemTotal; }; typedef test_group<RefCountedTestData> RefCountedTestGroupType; @@ -51,18 +49,12 @@ namespace tut { set_test_name("RefCounted construction with implicit count"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference RefCounted * rc = new RefCounted(true); ensure(rc->getRefCount() == 1); // release the implicit reference, causing the object to be released rc->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -70,9 +62,6 @@ namespace tut { set_test_name("RefCounted construction without implicit count"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - // create a new ref counted object with an implicit reference RefCounted * rc = new RefCounted(false); ensure(rc->getRefCount() == 0); @@ -83,8 +72,6 @@ namespace tut // release the implicit reference, causing the object to be released rc->release(); - - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -92,9 +79,6 @@ namespace tut { set_test_name("RefCounted addRef and release"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - RefCounted * rc = new RefCounted(false); for (int i = 0; i < 1024; ++i) @@ -108,9 +92,6 @@ namespace tut { rc->release(); } - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -118,9 +99,6 @@ namespace tut { set_test_name("RefCounted isLastRef check"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - RefCounted * rc = new RefCounted(true); // with only one reference, isLastRef should be true @@ -128,9 +106,6 @@ namespace tut // release it to clean up memory rc->release(); - - // make sure we didn't leak any memory - ensure(mMemTotal == GetMemTotal()); } template <> template <> @@ -138,9 +113,6 @@ namespace tut { set_test_name("RefCounted noRef check"); - // record the total amount of dynamically allocated memory - mMemTotal = GetMemTotal(); - RefCounted * rc = new RefCounted(false); // set the noRef @@ -148,10 +120,7 @@ namespace tut // with only one reference, isLastRef should be true ensure(rc->getRefCount() == RefCounted::NOT_REF_COUNTED); - - // allow this memory leak, but check that we're leaking a known amount - ensure(mMemTotal == (GetMemTotal() - sizeof(RefCounted))); } } -#endif // if 0 +#endif // disabling on Win64 #endif // TEST_LLCOREINT_REF_COUNTED_H_ |