Skip to content

Commit e3d8249

Browse files
committed
Finish release 0.6
2 parents 4123c1c + 1138f7b commit e3d8249

104 files changed

Lines changed: 11621 additions & 6281 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
AccessModifierOffset: -4
2+
AlignAfterOpenBracket: Align
3+
AlignConsecutiveAssignments: true
4+
AlignConsecutiveDeclarations: true
5+
AlignEscapedNewlinesLeft: false
6+
AlignOperands: true
7+
AlignTrailingComments: true
8+
AllowAllParametersOfDeclarationOnNextLine: true
9+
AllowShortBlocksOnASingleLine: false
10+
AllowShortCaseLabelsOnASingleLine: false
11+
AllowShortFunctionsOnASingleLine: Empty
12+
AllowShortIfStatementsOnASingleLine: false
13+
AllowShortLoopsOnASingleLine: false
14+
AlwaysBreakAfterReturnType: None
15+
AlwaysBreakBeforeMultilineStrings: false
16+
AlwaysBreakTemplateDeclarations: true
17+
BinPackArguments: true
18+
BinPackParameters: true
19+
BreakBeforeBinaryOperators: NonAssignment
20+
BreakBeforeBraces: Allman
21+
BreakBeforeTernaryOperators: false
22+
BreakConstructorInitializersBeforeComma: false
23+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
24+
ConstructorInitializerIndentWidth: 0
25+
ContinuationIndentWidth: 4
26+
ColumnLimit: 100
27+
Cpp11BracedListStyle: true
28+
IndentCaseLabels: false
29+
IndentWidth: 4
30+
IndentWrappedFunctionNames: true
31+
Language: Cpp
32+
KeepEmptyLinesAtTheStartOfBlocks: false
33+
MaxEmptyLinesToKeep: 1
34+
NamespaceIndentation: All
35+
PenaltyBreakBeforeFirstCallParameter: 19937
36+
PenaltyReturnTypeOnItsOwnLine: 19937
37+
PointerAlignment: Left
38+
ReflowComments: false
39+
SortIncludes: false
40+
SpaceAfterCStyleCast: false
41+
SpaceBeforeAssignmentOperators: true
42+
SpaceBeforeParens: ControlStatements
43+
SpaceInEmptyParentheses: false
44+
SpacesBeforeTrailingComments: 1
45+
SpacesInAngles: false
46+
SpacesInCStyleCastParentheses: false
47+
SpacesInParentheses: false
48+
SpacesInSquareBrackets: false
49+
Standard: Cpp11
50+
TabWidth: 4
51+
UseTab: Never

.travis.yml

Lines changed: 74 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,79 @@
11
language: cpp
2-
env:
3-
- compiler='g++-4.8' build_type='Debug'
4-
- compiler='g++-4.8' build_type='Release'
5-
- compiler='g++-4.9' build_type='Debug'
6-
- compiler='g++-4.9' build_type='Release'
7-
- compiler='g++-5' build_type='Debug'
8-
- compiler='g++-5' build_type='Release'
9-
addons:
10-
apt:
11-
sources:
12-
- ubuntu-toolchain-r-test
13-
packages:
14-
- g++-4.8
15-
- g++-4.9
16-
- g++-5
2+
3+
matrix:
4+
include:
5+
- os: linux
6+
compiler: gcc
7+
addons:
8+
apt:
9+
sources: ['ubuntu-toolchain-r-test']
10+
packages: ['g++-4.8']
11+
env: TOOLSET=g++-4.8 BUILD_TYPE='Debug'
12+
- os: linux
13+
compiler: gcc
14+
addons:
15+
apt:
16+
sources: ['ubuntu-toolchain-r-test']
17+
packages: ['g++-4.8']
18+
env: TOOLSET=g++-4.8 BUILD_TYPE='Release'
19+
20+
- os: linux
21+
compiler: gcc
22+
addons:
23+
apt:
24+
sources: ['ubuntu-toolchain-r-test']
25+
packages: ['g++-4.9']
26+
env: TOOLSET=g++-4.9 BUILD_TYPE='Debug'
27+
- os: linux
28+
compiler: gcc
29+
addons:
30+
apt:
31+
sources: ['ubuntu-toolchain-r-test']
32+
packages: ['g++-4.9']
33+
env: TOOLSET=g++-4.9 BUILD_TYPE='Release'
34+
35+
- os: linux
36+
compiler: gcc
37+
addons:
38+
apt:
39+
sources: ['ubuntu-toolchain-r-test']
40+
packages: ['g++-5']
41+
env: TOOLSET=g++-5 BUILD_TYPE='Debug'
42+
- os: linux
43+
compiler: gcc
44+
addons:
45+
apt:
46+
sources: ['ubuntu-toolchain-r-test']
47+
packages: ['g++-5']
48+
env: TOOLSET=g++-5 BUILD_TYPE='Release'
49+
50+
- os: osx
51+
compiler: clang
52+
env: TOOLSET=clang++ BUILD_TYPE='Debug'
53+
- os: osx
54+
compiler: clang
55+
env: TOOLSET=clang++ BUILD_TYPE='Release'
56+
1757
install:
18-
- wget --no-check-certificate https://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz
19-
- tar -xzf cmake-3.3.1-Linux-x86_64.tar.gz
20-
- export CC='gcc-4.8'
21-
- export CXX=$compiler
58+
- cd ../
59+
60+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-check-certificate https://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz; fi
61+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf cmake-3.3.1-Linux-x86_64.tar.gz; fi
62+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CMAKE=$TRAVIS_BUILD_DIR/../cmake-3.3.1-Linux-x86_64/bin/cmake; fi
63+
64+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget --no-check-certificate https://cmake.org/files/v3.3/cmake-3.3.0-Darwin-x86_64.tar.gz; fi
65+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -xzf cmake-3.3.0-Darwin-x86_64.tar.gz && ls && ls cmake-3.3.0-Darwin-x86_64; fi
66+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE=$TRAVIS_BUILD_DIR/../cmake-3.3.0-Darwin-x86_64/CMake.app/Contents/bin/cmake; fi
67+
68+
- export CXX=$TOOLSET
69+
- $CXX --version
70+
- $CMAKE --version
71+
72+
- cd memory/
73+
2274
script:
23-
- mkdir $CXX && cd $CXX
24-
- ../cmake-3.3.1-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=$build_type -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Wno-parentheses" ../
25-
- ../cmake-3.3.1-Linux-x86_64/bin/cmake --build .
75+
- mkdir build/ && cd build/
76+
- $CMAKE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Wno-parentheses" ../
77+
- $CMAKE --build .
2678
- ./test/foonathan_memory_test
2779
- ./test/foonathan_memory_profiling 1

CHANGELOG.MD

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
1-
0.5
1+
# 0.6
2+
3+
## Tool
4+
5+
* better MSVC support
6+
* improved compilation time
7+
8+
## Core
9+
10+
* add literal operators for memory sizes (`4_KiB`)
11+
* more flexible `make_block_allocator`
12+
* composable allocator concept
13+
14+
## Allocator
15+
16+
* improved `temporary_allocator`: explicit separation into `temporary_stack`, improved automatic creation
17+
* new `memory_stack_raii_unwind` for automatic unwinding
18+
* new `iteration_allocator`
19+
* make allocators composable
20+
* add facilities for joint memory allocations
21+
22+
## Adapter
23+
24+
* add `shared_ptr_node_size`
25+
* add `string` container typedef
26+
* add `fallback_allocator`
27+
* add `segregator`
28+
29+
## Bugfixes
30+
31+
* OSX support
32+
* various warnings fixed
33+
234
---
35+
36+
# 0.5
337
* improved CMake build system, now supports cmake installation and `find_package()`
438
* improved low-level allocators and added `malloc_allocator`
539
* add virtual memory interface and allocators
@@ -11,8 +45,10 @@
1145
* other improvements like concept checks and more exception classes
1246
* internal changes
1347

14-
0.4
1548
---
49+
50+
# 0.4
51+
1652
* polished up the interface, many breaking changes in the form of renaming and new header files
1753
* added unified error handling facilities and handler functions in case exceptions are not supported
1854
* improved old allocator adapters by introducing allocator_storage template
@@ -24,26 +60,34 @@
2460
* added miscellaneous tiny features all over the place
2561
* many internal changes and bugfixes
2662

27-
0.3
2863
---
64+
65+
# 0.3
66+
2967
* added debugging options such as memory filling and deallocation and leak check
3068
* improved performance of pool allocators
3169
* changed complete project structure and CMake
3270
* many internal changes and bugfixes and automated testing
3371

34-
0.2
3572
---
73+
74+
# 0.2
75+
3676
* added temporary_allocator as portable alloca
3777
* added small_node_pool type optimized for low-overhead small object allocations
3878
* added various allocator adapters including a thread_safe_allocator for locking
3979
* better compiler support
4080
* many internal changes and bugfixes
4181

42-
0.1-1
43-
-----
82+
---
83+
84+
# 0.1-1
85+
4486
* critical bugfix in memory_stack
4587
* added smart pointer example
4688

47-
0.1
4889
---
90+
91+
# 0.1
92+
4993
* first beta version

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ Several implementations:
1717
* `heap_/malloc_/new_allocator`
1818
* virtual memory allocators
1919
* allocator using a static memory block located on the stack
20-
* memory stack
20+
* memory stack, `iteration_allocator`
2121
* different memory pools
2222
* a portable, improved `alloca()` in the form of `temporary_allocator`
23+
* facilities for joint memory allocations: share a big memory block for the object
24+
and all dynamic memory allocations for its members
2325

2426
Adapters, wrappers and storage classes:
2527

@@ -58,10 +60,12 @@ void merge_sort(BiIter begin, BiIter end);
5860

5961
int main()
6062
{
63+
using namespace memory::literals;
64+
6165
// a memory pool RawAllocator
6266
// allocates a memory block - initially 4KiB - and splits it into chunks of list_node_size<int>::value big
6367
// list_node_size<int>::value is the size of each node of a std::list
64-
memory::memory_pool<> pool(memory::list_node_size<int>::value, 4096u);
68+
memory::memory_pool<> pool(memory::list_node_size<int>::value, 4_KiB);
6569

6670
// just an alias for std::list<int, memory::std_allocator<int, memory::memory_pool<>>
6771
// a std::list using a memory_pool
@@ -147,15 +151,13 @@ See `example/` for more.
147151
## Installation
148152
149153
This library can be used as [CMake] subdirectory.
150-
It is tested on GCC 4.7-4.9, Clang 3.4-3.5 and Visual Studio 2013. Newer versions should work too.
154+
It is tested on GCC 4.8-5.0, Clang 3.5 and Visual Studio 2013. Newer versions should work too.
151155
152156
1. Fetch it, e.g. using [git submodules] `git submodule add https://github.com/foonathan/memory ext/memory` and `git submodule update --init --recursive`.
153157
154158
2. Call `add_subdirectory(ext/memory)` or whatever your local path is to make it available in CMake.
155159
156-
3. Simply call `target_link_libraries(your_target PUBLIC foonathan_memory)` to link this library and setups the include search path.
157-
158-
4. You need to activate C++11 at your target, if not already done, you can use [foonathan/compatibility] already available through `add_subdirectory()` and call `comp_target_features(your_target PUBLIC CPP11)`.
160+
3. Simply call `target_link_libraries(your_target PUBLIC foonathan_memory)` to link this library and setups the include search path and compilation options.
159161
160162
*Note: If during CMake you see an error message that compatibility is
161163
not on the newest version, run `git submodule update
@@ -170,12 +172,12 @@ You can also install the library:
170172
171173
3. Repeat 1 and 2 for each build type/configuration you want to have (like `Debug`, `RelWithDebInfo` and `Release` or custom names).
172174
173-
The use an installed library:
175+
To use an installed library:
174176
175177
4. Call `find_package(foonathan_memory major.minor REQUIRED)` to find the library.
176178
177-
5. Call `target_link_libraries(your_target PUBLIC foonathan_memory)` and activate C++11 to link to the library.
178-
179+
5. Call `target_link_libraries(your_target PUBLIC foonathan_memory)` to link to the library and setup all required options.
180+
179181
See http://foonathan.github.io/doc/memory/md_doc_installation.html for a detailed guide.
180182
181183
## Documentation

appveyor.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '{build}'
2+
build_script:
3+
- cmd: git submodule update --init --recursive
4+
5+
- cmd: mkdir build-12 && cd build-12
6+
- cmd: cmake -G"Visual Studio 12" -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF ..\
7+
- cmd: cmake --build . -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
8+
9+
- cmd: cd ..\ && mkdir build-14-debug && cd build-14-debug\
10+
- cmd: cmake -G"Visual Studio 14" -DCMAKE_BUILD_TYPE=Debug ..\
11+
- cmd: cmake --build . --config Debug -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
12+
- cmd: test\Debug\foonathan_memory_test.exe
13+
14+
- cmd: cd ..\ && mkdir build-14-release && cd build-14-release\
15+
- cmd: cmake -G"Visual Studio 14" -DCMAKE_BUILD_TYPE=Release ..\
16+
- cmd: cmake --build . --config Release -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
17+
- cmd: test\Release\foonathan_memory_test.exe
18+

cmake/comp

cmake/compatibility.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/comp/comp_base.cmake)
1111
add_library(_foonathan_memory_comp_runner INTERFACE)
1212
set(_foonathan_memory_comp_include_path "${CMAKE_CURRENT_BINARY_DIR}")
1313
comp_target_features(_foonathan_memory_comp_runner INTERFACE
14-
cpp11_lang/alignas cpp11_lang/alignof cpp11_lang/constexpr cpp11_lang/noexcept cpp11_lang/thread_local
14+
cpp11_lang/alignas cpp11_lang/alignof cpp11_lang/constexpr
15+
cpp11_lang/noexcept cpp11_lang/thread_local cpp11_lang/literal_op
1516
cpp11_lib/get_new_handler cpp11_lib/max_align_t cpp11_lib/mutex
1617
ts/pmr
1718
env/exception_support env/hosted_implementation
@@ -22,7 +23,7 @@ comp_target_features(_foonathan_memory_comp_runner INTERFACE
2223
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/foonathan DESTINATION include/comp)
2324

2425
function(_foonathan_use_comp target)
25-
comp_target_features(${target} PRIVATE CPP11)
26+
target_compile_options(${target} PUBLIC ${_foonathan_memory_comp_runner_COMP_COMPILE_OPTIONS})
2627
target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${_foonathan_memory_comp_include_path}>
2728
$<INSTALL_INTERFACE:include/comp>)
2829
endfunction()

cmake/configuration.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,5 @@ set(FOONATHAN_MEMORY_MEMORY_RESOURCE foonathan_comp::memory_resource CACHE STRIN
8080
"the memory_resource class used")
8181
option(FOONATHAN_MEMORY_EXTERN_TEMPLATE
8282
"whether or not common template instantiations are already provided by the library" ON)
83+
set(FOONATHAN_MEMORY_TEMPORARY_STACK_MODE 2 CACHE STRING
84+
"set to 0 to disable the per-thread stack completely, to 1 to disable the nitfy counter and to 2 to enable everything")

doc/adapters_storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ It does not take ownership, i.e. the passed allocator object must live longer th
3737
* For stateless allocators, it uses a `static` object in order to return a reference in `get_allocator()`.
3838
But this means that they don't actually depend on the lifetime of the given allocator and also can take temporaries.
3939

40-
* For special allocators that already provide reference semantics (determinted through traits specialization), it behaves like a [direct_storage] policy.
40+
* For special allocators that already provide reference semantics (determined through traits specialization), it behaves like a [direct_storage] policy.
4141

4242
In either case, the class is nothrow copyable and never actually moves the referred allocator, just copies the pointer.
4343
A copy of a [reference_storage] references the same allocator as the origin.

0 commit comments

Comments
 (0)