Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67591 - sandbox/guild/pool/libs/pool/test
From: chankwanting_at_[hidden]
Date: 2011-01-02 15:26:29


Author: ktchan
Date: 2011-01-02 15:26:28 EST (Sun, 02 Jan 2011)
New Revision: 67591
URL: http://svn.boost.org/trac/boost/changeset/67591

Log:
Add test for bug #4346.
Added:
   sandbox/guild/pool/libs/pool/test/test_msvc_mem_leak_detection.cpp (contents, props changed)
Text files modified:
   sandbox/guild/pool/libs/pool/test/Jamfile.v2 | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Modified: sandbox/guild/pool/libs/pool/test/Jamfile.v2
==============================================================================
--- sandbox/guild/pool/libs/pool/test/Jamfile.v2 (original)
+++ sandbox/guild/pool/libs/pool/test/Jamfile.v2 2011-01-02 15:26:28 EST (Sun, 02 Jan 2011)
@@ -15,4 +15,5 @@
 test-suite pool :
     [ run test_pool_alloc.cpp ]
     [ run pool_msvc_compiler_bug_test.cpp ]
+ [ run test_msvc_mem_leak_detection.cpp ]
     ;

Added: sandbox/guild/pool/libs/pool/test/test_msvc_mem_leak_detection.cpp
==============================================================================
--- (empty file)
+++ sandbox/guild/pool/libs/pool/test/test_msvc_mem_leak_detection.cpp 2011-01-02 15:26:28 EST (Sun, 02 Jan 2011)
@@ -0,0 +1,49 @@
+/* Copyright (C) 2011 Kwan Ting Chan
+ *
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// Test of bug #4346 (https://svn.boost.org/trac/boost/ticket/4346)
+
+#ifdef _MSC_VER
+#define _CRTDBG_MAP_ALLOC
+#include <stdlib.h>
+#include <crtdbg.h>
+#endif
+
+#include <boost/pool/poolfwd.hpp>
+#include <boost/pool/simple_segregated_storage.hpp>
+#include <boost/pool/pool.hpp>
+#include <boost/pool/pool_alloc.hpp>
+#include <boost/pool/singleton_pool.hpp>
+#include <boost/pool/object_pool.hpp>
+
+#include <vector>
+
+struct Foo {};
+
+int main()
+{
+ {
+ boost::pool<> p(sizeof(int));
+ int * const t = (int*)(p.malloc)();
+ }
+
+ {
+ boost::object_pool<Foo> p;
+ Foo * const t = (Foo*)(p.malloc)();
+ }
+
+ {
+ int * const t = (int*)(boost::singleton_pool<Foo, sizeof(int)>::malloc)();
+ }
+ boost::singleton_pool<Foo, sizeof(int)>::purge_memory();
+
+ {
+ std::vector<int, boost::pool_allocator<int> > v;
+ v.push_back(8);
+ }
+ boost::singleton_pool<boost::pool_allocator_tag, sizeof(int)>::release_memory();
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk