From b3aa1f59b26e8083df8a652bda656110ab8ce3a3 Mon Sep 17 00:00:00 2001 From: Junwha Hong Date: Mon, 25 Dec 2023 20:34:03 +0900 Subject: [PATCH 1/2] fix: delete validator before clear --- test/perftest/schematest.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/perftest/schematest.cpp b/test/perftest/schematest.cpp index 7d27344b5..489c1e46f 100644 --- a/test/perftest/schematest.cpp +++ b/test/perftest/schematest.cpp @@ -205,12 +205,13 @@ TEST_F(Schema, TestSuite) { for (int i = 0; i < trialCount; i++) { for (TestSuiteList::const_iterator itr = testSuites.begin(); itr != testSuites.end(); ++itr) { const TestSuite& ts = **itr; - GenericSchemaValidator >, MemoryPoolAllocator<> > validator(*ts.schema, &validatorAllocator); + GenericSchemaValidator >, MemoryPoolAllocator<>> *validator = new GenericSchemaValidator >, MemoryPoolAllocator<>>(*ts.schema, &validatorAllocator); for (DocumentList::const_iterator testItr = ts.tests.begin(); testItr != ts.tests.end(); ++testItr) { - validator.Reset(); - (*testItr)->Accept(validator); + validator->Reset(); + (*testItr)->Accept(*validator); testCount++; } + delete validator; validatorAllocator.Clear(); } } From 8a8ac91933126b2e83aabfcbb6cdb384f4785ba6 Mon Sep 17 00:00:00 2001 From: Junwha Hong Date: Tue, 26 Dec 2023 21:13:30 +0900 Subject: [PATCH 2/2] Wrap GenericSchemaValidator to destruct the validator first --- test/perftest/schematest.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/perftest/schematest.cpp b/test/perftest/schematest.cpp index 489c1e46f..90cd22ab4 100644 --- a/test/perftest/schematest.cpp +++ b/test/perftest/schematest.cpp @@ -205,13 +205,14 @@ TEST_F(Schema, TestSuite) { for (int i = 0; i < trialCount; i++) { for (TestSuiteList::const_iterator itr = testSuites.begin(); itr != testSuites.end(); ++itr) { const TestSuite& ts = **itr; - GenericSchemaValidator >, MemoryPoolAllocator<>> *validator = new GenericSchemaValidator >, MemoryPoolAllocator<>>(*ts.schema, &validatorAllocator); - for (DocumentList::const_iterator testItr = ts.tests.begin(); testItr != ts.tests.end(); ++testItr) { - validator->Reset(); - (*testItr)->Accept(*validator); - testCount++; + { + GenericSchemaValidator >, MemoryPoolAllocator<> > validator(*ts.schema, &validatorAllocator); + for (DocumentList::const_iterator testItr = ts.tests.begin(); testItr != ts.tests.end(); ++testItr) { + validator.Reset(); + (*testItr)->Accept(validator); + testCount++; + } } - delete validator; validatorAllocator.Clear(); } }