|
Boost-Commit : |
From: xushiweizh_at_[hidden]
Date: 2008-04-28 21:28:06
Author: xushiwei
Date: 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
New Revision: 44866
URL: http://svn.boost.org/trac/boost/changeset/44866
Log:
boost-memory version 1.0
Added:
sandbox/memory/libs/memory/StdAfx.cpp (contents, props changed)
sandbox/memory/libs/memory/bin/linux/libboost-memory.so (contents, props changed)
sandbox/memory/libs/memory/bin/win32/boost-memory.dll (contents, props changed)
sandbox/memory/libs/memory/build/
sandbox/memory/libs/memory/doc/
sandbox/memory/libs/memory/lib/
sandbox/memory/libs/memory/lib/boost-memory.lib (contents, props changed)
sandbox/memory/libs/memory/memory.def (contents, props changed)
sandbox/memory/libs/memory/memory.dsp (contents, props changed)
sandbox/memory/libs/memory/memory.prj.li (contents, props changed)
sandbox/memory/libs/memory/memory.vcproj (contents, props changed)
sandbox/memory/libs/memory/memory_w32.def (contents, props changed)
sandbox/memory/libs/memory/src/
sandbox/memory/libs/memory/src/block_pool.cpp (contents, props changed)
sandbox/memory/libs/memory/stdafx.h (contents, props changed)
sandbox/memory/libs/memory/test/
sandbox/memory/libs/memory/test/memory/
sandbox/memory/libs/memory/test/memory/simple_examples.cpp (contents, props changed)
sandbox/memory/libs/memory/test/memory/stl_containers.cpp (contents, props changed)
sandbox/memory/libs/memory/test/test.cpp (contents, props changed)
sandbox/memory/libs/memory/test/test.dsp (contents, props changed)
sandbox/memory/libs/memory/test/test.prj.li (contents, props changed)
sandbox/memory/libs/memory/test/test.vcproj (contents, props changed)
Added: sandbox/memory/libs/memory/StdAfx.cpp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/StdAfx.cpp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// memory.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
Added: sandbox/memory/libs/memory/bin/linux/libboost-memory.so
==============================================================================
Binary file. No diff available.
Added: sandbox/memory/libs/memory/bin/win32/boost-memory.dll
==============================================================================
Binary file. No diff available.
Added: sandbox/memory/libs/memory/lib/boost-memory.lib
==============================================================================
Binary file. No diff available.
Added: sandbox/memory/libs/memory/memory.def
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/memory.def 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,2 @@
+EXPORTS
+ _boost_TlsBlockPool
Added: sandbox/memory/libs/memory/memory.dsp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/memory.dsp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="memory" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=memory - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "memory.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "memory.mak" CFG="memory - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "memory - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "memory - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "memory - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "lib"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STDEXT_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STDEXT_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"bin/win32/boost-memory.dll"
+
+!ELSEIF "$(CFG)" == "memory - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STDEXT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STDEXT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"bin/win32d/boost-memory.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "memory - Win32 Release"
+# Name "memory - Win32 Debug"
+# Begin Group "memory"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\block_pool.cpp
+# End Source File
+# End Group
+# Begin Group "misc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\memory_w32.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# End Group
+# End Target
+# End Project
Added: sandbox/memory/libs/memory/memory.prj.li
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/memory.prj.li 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,20 @@
+[Include]
+.
+../..
+
+[Config Release]
+Product Dll bin/linux/boost-memory
+Options Release; MultiThread; AnsiChar; NoRtti; Exception
+ObjDir LRelease
+LibDir
+Libraries
+
+[Config Debug]
+Product Dll bin/linuxd/boost-memory
+Options Debug; MultiThread; AnsiChar; NoRtti; Exception
+ObjDir LDebug
+LibDir
+Libraries
+
+[Source]
+memory.dsp
Added: sandbox/memory/libs/memory/memory.vcproj
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/memory.vcproj 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="memory"
+ ProjectGUID="{38995745-23B2-4629-9432-4E17633F9509}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\lib"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\lib/memory.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../../"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STDEXT_EXPORTS"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Release/memory.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="bin/win32/boost-memory.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\memory_w32.def"
+ ProgramDatabaseFile=".\lib/boost-memory.pdb"
+ ImportLibrary=".\lib/boost-memory.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\lib/memory.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\lib"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\lib/memory.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STDEXT_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/memory.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="bin/win32d/boost-memory.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\memory_w32.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\lib/boost-memory.pdb"
+ ImportLibrary=".\lib/boost-memory.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\lib/memory.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="memory"
+ >
+ <File
+ RelativePath="src\block_pool.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="misc"
+ >
+ <File
+ RelativePath="memory_w32.def"
+ >
+ </File>
+ <File
+ RelativePath="StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: sandbox/memory/libs/memory/memory_w32.def
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/memory_w32.def 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,2 @@
+EXPORTS
+ _boost_TlsBlockPool
Added: sandbox/memory/libs/memory/src/block_pool.cpp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/src/block_pool.cpp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,27 @@
+//
+// boost/memory/block_pool.cpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#include "stdafx.h"
+#include <boost/memory/scoped_alloc.hpp>
+
+// -------------------------------------------------------------------------
+
+using namespace boost;
+
+tls_block_pool_t _tls_blockPool;
+
+STDAPI_(tls_block_pool_t*) _boost_TlsBlockPool()
+{
+ return &_tls_blockPool;
+}
+
+// -------------------------------------------------------------------------
+// $Log: $
Added: sandbox/memory/libs/memory/stdafx.h
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/stdafx.h 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,24 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__3B50CB3B_9820_4D90_980F_D4AFDBFCFF20__INCLUDED_)
+#define AFX_STDAFX_H__3B50CB3B_9820_4D90_980F_D4AFDBFCFF20__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+// Insert your headers here
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include <boost/memory/basic.hpp>
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__3B50CB3B_9820_4D90_980F_D4AFDBFCFF20__INCLUDED_)
Added: sandbox/memory/libs/memory/test/memory/simple_examples.cpp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/memory/simple_examples.cpp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,65 @@
+//
+// simple_examples.cpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#include <boost/memory.hpp>
+
+// -------------------------------------------------------------------------
+// TestCase
+
+void testAutoAlloc()
+{
+ boost::auto_alloc alloc;
+ int* intObj = BOOST_NEW(alloc, int);
+ int* intObjWithArg = BOOST_NEW(alloc, int)(10);
+ int* intArray = BOOST_NEW_ARRAY(alloc, int, 100);
+ int* intBuf = BOOST_ALLOC(alloc, int);
+ int* intArrayBuf = BOOST_ALLOC_ARRAY(alloc, int, 100);
+
+ boost::auto_alloc* subAlloc = BOOST_NEW(alloc, boost::auto_alloc);
+ int* e = BOOST_NEW(*subAlloc, int);
+}
+
+void testScopedAlloc()
+{
+ boost::block_pool recycle;
+ boost::scoped_alloc alloc(recycle);
+
+ int* intObj = BOOST_NEW(alloc, int);
+ int* intObjWithArg = BOOST_NEW(alloc, int)(10);
+ int* intArray = BOOST_NEW_ARRAY(alloc, int, 100);
+ int* intBuf = BOOST_ALLOC(alloc, int);
+ int* intArrayBuf = BOOST_ALLOC_ARRAY(alloc, int, 100);
+
+ boost::scoped_alloc* suballoc = BOOST_NEW(alloc, boost::scoped_alloc)(alloc);
+ int* e = BOOST_NEW(*suballoc, int);
+}
+
+void testTlsScopedAlloc()
+{
+ boost::scoped_alloc alloc;
+ // same as: boost::scoped_alloc(boost::tls_block_pool::instance());
+
+ int* intObj = BOOST_NEW(alloc, int);
+ int* intObjWithArg = BOOST_NEW(alloc, int)(10);
+ int* intArray = BOOST_NEW_ARRAY(alloc, int, 100);
+ int* intBuf = BOOST_ALLOC(alloc, int);
+ int* intArrayBuf = BOOST_ALLOC_ARRAY(alloc, int, 100);
+
+ boost::scoped_alloc* suballoc = BOOST_NEW(alloc, boost::scoped_alloc);
+ int* e = BOOST_NEW(*suballoc, int);
+}
+
+void simpleExamples()
+{
+ testAutoAlloc();
+ testScopedAlloc();
+ testTlsScopedAlloc();
+}
Added: sandbox/memory/libs/memory/test/memory/stl_containers.cpp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/memory/stl_containers.cpp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,67 @@
+//
+// stl_contianers.cpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+
+#pragma warning(disable:4786)
+#include <boost/memory.hpp>
+#include <set>
+#include <map>
+#include <list>
+#include <deque>
+#include <cstdio>
+
+// -------------------------------------------------------------------------
+
+enum { Count = 1000000 };
+
+void testDeque()
+{
+ printf("\n===== Deque (scoped_alloc) =====\n");
+ boost::scoped_alloc alloc;
+ std::deque<int, boost::stl_alloc<int> > s(alloc);
+ for (int i = 0; i < Count; ++i)
+ s.push_back(i);
+}
+
+void testList()
+{
+ printf("\n===== List (scoped_alloc) =====\n");
+ boost::scoped_alloc alloc;
+ std::list<int, boost::stl_alloc<int> > s(alloc);
+ for (int i = 0; i < Count; ++i)
+ s.push_back(i);
+}
+
+void testSet()
+{
+ printf("\n===== Set (scoped_alloc) =====\n");
+ boost::scoped_alloc alloc;
+ std::set<int, std::less<int>, boost::stl_alloc<int> > s(std::less<int>(), alloc);
+ for (int i = 0; i < Count; ++i)
+ s.insert(i);
+}
+
+void testMap()
+{
+ printf("\n===== Map (scoped_alloc) =====\n");
+ boost::scoped_alloc alloc;
+ std::map<int, int, std::less<int>, boost::stl_alloc<int> > s(std::less<int>(), alloc);
+ for (int i = 0; i < Count; ++i)
+ s.insert(std::pair<int, int>(i, i));
+}
+
+void testStlContainers()
+{
+ testDeque();
+ testList();
+ testSet();
+ testMap();
+}
Added: sandbox/memory/libs/memory/test/test.cpp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/test.cpp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,23 @@
+//
+// stl_contianers.cpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+
+#include <boost/memory/linklib.hpp>
+
+void testStlContainers();
+void simpleExamples();
+
+int main()
+{
+ simpleExamples();
+ testStlContainers();
+ return 0;
+}
Added: sandbox/memory/libs/memory/test/test.dsp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/test.dsp 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,100 @@
+# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "test.mak" CFG="test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x804 /d "NDEBUG"
+# ADD RSC /l 0x804 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"../lib"
+
+!ELSEIF "$(CFG)" == "test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x804 /d "_DEBUG"
+# ADD RSC /l 0x804 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "test - Win32 Release"
+# Name "test - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\memory\simple_examples.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\memory\stl_containers.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\test.cpp
+# End Source File
+# End Target
+# End Project
Added: sandbox/memory/libs/memory/test/test.prj.li
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/test.prj.li 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,20 @@
+[Include]
+../../..
+
+[Config Release]
+Product Exe LRelease/test
+Options Release; MultiThread; AnsiChar; NoRtti; Exception
+ObjDir LRelease
+LibDir LRelease
+Libraries rt; boost-memory
+
+[Config Debug]
+Product Exe LDebug/test
+Options Debug; MultiThread; AnsiChar; NoRtti; Exception
+ObjDir LDebug
+LibDir LDebug
+Libraries rt; boost-memory
+
+[Source]
+test.dsp
+
Added: sandbox/memory/libs/memory/test/test.vcproj
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/test.vcproj 2008-04-28 21:28:04 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="test"
+ ProjectGUID="{DAFD3447-9ADE-4324-B689-7170596AD086}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/test.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../../../"
+ PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/test.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2052"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\Release/test.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="../lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Release/test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/test.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../"
+ PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/test.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2052"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\Debug/test.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="../lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="memory\simple_examples.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="memory\stl_containers.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="test.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
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