mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 14:04:26 +02:00
Added NO_MALLINFO and NO_MALLOC_STATS defines to dlmalloc to avoid dependencies. Implemented boost_cont_allocated_memory based on internal_mallinfo
This commit is contained in:
@@ -1,199 +1,199 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="7.10"
|
Version="7.10"
|
||||||
Name="_alloc_lib"
|
Name="_alloc_lib"
|
||||||
ProjectGUID="{685AC59C-E667-4096-9DAA-AB76083C7092}"
|
ProjectGUID="{685AC59C-E667-4096-9DAA-AB76083C7092}"
|
||||||
Keyword="Win32Proj">
|
Keyword="Win32Proj">
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"/>
|
Name="Win32"/>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="..\..\Bin\Debug"
|
OutputDirectory="..\..\Bin\Debug"
|
||||||
IntermediateDirectory="Debug"
|
IntermediateDirectory="Debug"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\.."
|
AdditionalIncludeDirectories="..\..\..\.."
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="FALSE"
|
Detect64BitPortabilityProblems="FALSE"
|
||||||
DebugInformationFormat="4"/>
|
DebugInformationFormat="4"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/alloc_lib.lib"/>
|
OutputFile="$(OutDir)/alloc_lib.lib"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="..\..\Bin\Release"
|
OutputDirectory="..\..\Bin\Release"
|
||||||
IntermediateDirectory="Release"
|
IntermediateDirectory="Release"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="..\..\..\.."
|
AdditionalIncludeDirectories="..\..\..\.."
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="FALSE"
|
Detect64BitPortabilityProblems="FALSE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/alloc_lib.lib"/>
|
OutputFile="$(OutDir)/alloc_lib.lib"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\alloc_lib.c">
|
RelativePath="..\..\src\alloc_lib.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\adaptive_pool.hpp">
|
RelativePath="..\..\..\..\boost\container\adaptive_pool.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\allocator.hpp">
|
RelativePath="..\..\..\..\boost\container\allocator.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\node_allocator.hpp">
|
RelativePath="..\..\..\..\boost\container\node_allocator.hpp">
|
||||||
</File>
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="detail"
|
Name="detail"
|
||||||
Filter="">
|
Filter="">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\adaptive_node_pool.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\adaptive_node_pool.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\alloc_lib.h">
|
RelativePath="..\..\..\..\boost\container\detail\alloc_lib.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\alloc_lib_auto_link.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\alloc_lib_auto_link.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\auto_link.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\auto_link.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\mutex.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\mutex.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\node_pool.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\node_pool.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\pool_common_alloc.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\pool_common_alloc.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\singleton.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\singleton.hpp">
|
||||||
</File>
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Included Sources"
|
Name="Included Sources"
|
||||||
Filter="">
|
Filter="">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\dlmalloc_2_8_6.c">
|
RelativePath="..\..\src\dlmalloc_2_8_6.c">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"/>
|
Name="VCCLCompilerTool"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"/>
|
Name="VCCLCompilerTool"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\dlmalloc_ext_2_8_6.c">
|
RelativePath="..\..\src\dlmalloc_ext_2_8_6.c">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"/>
|
Name="VCCLCompilerTool"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"/>
|
Name="VCCLCompilerTool"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="test"
|
Name="test"
|
||||||
Filter="">
|
Filter="">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\test\Jamfile.v2">
|
RelativePath="..\..\test\Jamfile.v2">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="doc"
|
Name="doc"
|
||||||
Filter="">
|
Filter="">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\doc\Applying classic memory allocation improvements to C++ containers.html">
|
RelativePath="..\..\doc\Applying classic memory allocation improvements to C++ containers.html">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
</VisualStudioProject>
|
</VisualStudioProject>
|
||||||
|
@@ -19,7 +19,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#define USE_LOCKS 1
|
#define USE_LOCKS 1
|
||||||
#define MSPACES 1
|
#define MSPACES 1
|
||||||
#define NO_MALLINFO 0
|
#define NO_MALLINFO 1
|
||||||
|
#define NO_MALLOC_STATS 1
|
||||||
|
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
#if !defined(DEBUG)
|
#if !defined(DEBUG)
|
||||||
@@ -1179,12 +1181,47 @@ BOOST_CONTAINER_DECL size_t boost_cont_footprint()
|
|||||||
|
|
||||||
BOOST_CONTAINER_DECL size_t boost_cont_allocated_memory()
|
BOOST_CONTAINER_DECL size_t boost_cont_allocated_memory()
|
||||||
{
|
{
|
||||||
struct mallinfo info = mspace_mallinfo(gm);
|
size_t alloc_mem = 0;
|
||||||
|
mstate m = (mstate)gm;
|
||||||
ensure_initialization();
|
ensure_initialization();
|
||||||
if(info.ordblks)
|
if (!ok_magic(ms)) {
|
||||||
return (size_t)(info.uordblks - (info.ordblks-1)*TOP_FOOT_SIZE);
|
USAGE_ERROR_ACTION(ms,ms);
|
||||||
else
|
}
|
||||||
return info.uordblks;
|
|
||||||
|
|
||||||
|
if (!PREACTION(m)) {
|
||||||
|
check_malloc_state(m);
|
||||||
|
if (is_initialized(m)) {
|
||||||
|
size_t nfree = SIZE_T_ONE; /* top always free */
|
||||||
|
size_t mfree = m->topsize + TOP_FOOT_SIZE;
|
||||||
|
size_t sum = mfree;
|
||||||
|
msegmentptr s = &m->seg;
|
||||||
|
while (s != 0) {
|
||||||
|
mchunkptr q = align_as_chunk(s->base);
|
||||||
|
while (segment_holds(s, q) &&
|
||||||
|
q != m->top && q->head != FENCEPOST_HEAD) {
|
||||||
|
size_t sz = chunksize(q);
|
||||||
|
sum += sz;
|
||||||
|
if (!is_inuse(q)) {
|
||||||
|
mfree += sz;
|
||||||
|
++nfree;
|
||||||
|
}
|
||||||
|
q = next_chunk(q);
|
||||||
|
}
|
||||||
|
s = s->next;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
size_t uordblks = m->footprint - mfree;
|
||||||
|
if(nfree)
|
||||||
|
alloc_mem = (size_t)(uordblks - (nfree-1)*TOP_FOOT_SIZE);
|
||||||
|
else
|
||||||
|
alloc_mem = uordblks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
POSTACTION(m);
|
||||||
|
}
|
||||||
|
return alloc_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_CONTAINER_DECL size_t boost_cont_chunksize(const void *p)
|
BOOST_CONTAINER_DECL size_t boost_cont_chunksize(const void *p)
|
||||||
|
Reference in New Issue
Block a user