Skip to content

Commit

Permalink
Finish release 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
foonathan committed Nov 21, 2016
2 parents 4123c1c + 1138f7b commit e3d8249
Show file tree
Hide file tree
Showing 104 changed files with 11,621 additions and 6,281 deletions.
51 changes: 51 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
ColumnLimit: 100
Cpp11BracedListStyle: true
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: true
Language: Cpp
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PenaltyBreakBeforeFirstCallParameter: 19937
PenaltyReturnTypeOnItsOwnLine: 19937
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
96 changes: 74 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,79 @@
language: cpp
env:
- compiler='g++-4.8' build_type='Debug'
- compiler='g++-4.8' build_type='Release'
- compiler='g++-4.9' build_type='Debug'
- compiler='g++-4.9' build_type='Release'
- compiler='g++-5' build_type='Debug'
- compiler='g++-5' build_type='Release'
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.9
- g++-5

matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8']
env: TOOLSET=g++-4.8 BUILD_TYPE='Debug'
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8']
env: TOOLSET=g++-4.8 BUILD_TYPE='Release'

- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
env: TOOLSET=g++-4.9 BUILD_TYPE='Debug'
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
env: TOOLSET=g++-4.9 BUILD_TYPE='Release'

- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5']
env: TOOLSET=g++-5 BUILD_TYPE='Debug'
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5']
env: TOOLSET=g++-5 BUILD_TYPE='Release'

- os: osx
compiler: clang
env: TOOLSET=clang++ BUILD_TYPE='Debug'
- os: osx
compiler: clang
env: TOOLSET=clang++ BUILD_TYPE='Release'

install:
- wget --no-check-certificate https://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz
- tar -xzf cmake-3.3.1-Linux-x86_64.tar.gz
- export CC='gcc-4.8'
- export CXX=$compiler
- cd ../

- 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
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf cmake-3.3.1-Linux-x86_64.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CMAKE=$TRAVIS_BUILD_DIR/../cmake-3.3.1-Linux-x86_64/bin/cmake; fi

- 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
- 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
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE=$TRAVIS_BUILD_DIR/../cmake-3.3.0-Darwin-x86_64/CMake.app/Contents/bin/cmake; fi

- export CXX=$TOOLSET
- $CXX --version
- $CMAKE --version

- cd memory/

script:
- mkdir $CXX && cd $CXX
- ../cmake-3.3.1-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=$build_type -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Wno-parentheses" ../
- ../cmake-3.3.1-Linux-x86_64/bin/cmake --build .
- mkdir build/ && cd build/
- $CMAKE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Wno-parentheses" ../
- $CMAKE --build .
- ./test/foonathan_memory_test
- ./test/foonathan_memory_profiling 1
58 changes: 51 additions & 7 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
0.5
# 0.6

## Tool

* better MSVC support
* improved compilation time

## Core

* add literal operators for memory sizes (`4_KiB`)
* more flexible `make_block_allocator`
* composable allocator concept

## Allocator

* improved `temporary_allocator`: explicit separation into `temporary_stack`, improved automatic creation
* new `memory_stack_raii_unwind` for automatic unwinding
* new `iteration_allocator`
* make allocators composable
* add facilities for joint memory allocations

## Adapter

* add `shared_ptr_node_size`
* add `string` container typedef
* add `fallback_allocator`
* add `segregator`

## Bugfixes

* OSX support
* various warnings fixed

---

# 0.5
* improved CMake build system, now supports cmake installation and `find_package()`
* improved low-level allocators and added `malloc_allocator`
* add virtual memory interface and allocators
Expand All @@ -11,8 +45,10 @@
* other improvements like concept checks and more exception classes
* internal changes

0.4
---

# 0.4

* polished up the interface, many breaking changes in the form of renaming and new header files
* added unified error handling facilities and handler functions in case exceptions are not supported
* improved old allocator adapters by introducing allocator_storage template
Expand All @@ -24,26 +60,34 @@
* added miscellaneous tiny features all over the place
* many internal changes and bugfixes

0.3
---

# 0.3

* added debugging options such as memory filling and deallocation and leak check
* improved performance of pool allocators
* changed complete project structure and CMake
* many internal changes and bugfixes and automated testing

0.2
---

# 0.2

* added temporary_allocator as portable alloca
* added small_node_pool type optimized for low-overhead small object allocations
* added various allocator adapters including a thread_safe_allocator for locking
* better compiler support
* many internal changes and bugfixes

0.1-1
-----
---

# 0.1-1

* critical bugfix in memory_stack
* added smart pointer example

0.1
---

# 0.1

* first beta version
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Several implementations:
* `heap_/malloc_/new_allocator`
* virtual memory allocators
* allocator using a static memory block located on the stack
* memory stack
* memory stack, `iteration_allocator`
* different memory pools
* a portable, improved `alloca()` in the form of `temporary_allocator`
* facilities for joint memory allocations: share a big memory block for the object
and all dynamic memory allocations for its members

Adapters, wrappers and storage classes:

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

int main()
{
using namespace memory::literals;

// a memory pool RawAllocator
// allocates a memory block - initially 4KiB - and splits it into chunks of list_node_size<int>::value big
// list_node_size<int>::value is the size of each node of a std::list
memory::memory_pool<> pool(memory::list_node_size<int>::value, 4096u);
memory::memory_pool<> pool(memory::list_node_size<int>::value, 4_KiB);

// just an alias for std::list<int, memory::std_allocator<int, memory::memory_pool<>>
// a std::list using a memory_pool
Expand Down Expand Up @@ -147,15 +151,13 @@ See `example/` for more.
## Installation
This library can be used as [CMake] subdirectory.
It is tested on GCC 4.7-4.9, Clang 3.4-3.5 and Visual Studio 2013. Newer versions should work too.
It is tested on GCC 4.8-5.0, Clang 3.5 and Visual Studio 2013. Newer versions should work too.
1. Fetch it, e.g. using [git submodules] `git submodule add https://github.com/foonathan/memory ext/memory` and `git submodule update --init --recursive`.
2. Call `add_subdirectory(ext/memory)` or whatever your local path is to make it available in CMake.
3. Simply call `target_link_libraries(your_target PUBLIC foonathan_memory)` to link this library and setups the include search path.
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)`.
3. Simply call `target_link_libraries(your_target PUBLIC foonathan_memory)` to link this library and setups the include search path and compilation options.
*Note: If during CMake you see an error message that compatibility is
not on the newest version, run `git submodule update
Expand All @@ -170,12 +172,12 @@ You can also install the library:
3. Repeat 1 and 2 for each build type/configuration you want to have (like `Debug`, `RelWithDebInfo` and `Release` or custom names).
The use an installed library:
To use an installed library:
4. Call `find_package(foonathan_memory major.minor REQUIRED)` to find the library.
5. Call `target_link_libraries(your_target PUBLIC foonathan_memory)` and activate C++11 to link to the library.
5. Call `target_link_libraries(your_target PUBLIC foonathan_memory)` to link to the library and setup all required options.
See http://foonathan.github.io/doc/memory/md_doc_installation.html for a detailed guide.
## Documentation
Expand Down
18 changes: 18 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '{build}'
build_script:
- cmd: git submodule update --init --recursive

- cmd: mkdir build-12 && cd build-12
- cmd: cmake -G"Visual Studio 12" -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF ..\
- cmd: cmake --build . -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

- cmd: cd ..\ && mkdir build-14-debug && cd build-14-debug\
- cmd: cmake -G"Visual Studio 14" -DCMAKE_BUILD_TYPE=Debug ..\
- cmd: cmake --build . --config Debug -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmd: test\Debug\foonathan_memory_test.exe

- cmd: cd ..\ && mkdir build-14-release && cd build-14-release\
- cmd: cmake -G"Visual Studio 14" -DCMAKE_BUILD_TYPE=Release ..\
- cmd: cmake --build . --config Release -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmd: test\Release\foonathan_memory_test.exe

2 changes: 1 addition & 1 deletion cmake/comp
Submodule comp updated 1 files
+17 −10 comp_base.cmake
5 changes: 3 additions & 2 deletions cmake/compatibility.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/comp/comp_base.cmake)
add_library(_foonathan_memory_comp_runner INTERFACE)
set(_foonathan_memory_comp_include_path "${CMAKE_CURRENT_BINARY_DIR}")
comp_target_features(_foonathan_memory_comp_runner INTERFACE
cpp11_lang/alignas cpp11_lang/alignof cpp11_lang/constexpr cpp11_lang/noexcept cpp11_lang/thread_local
cpp11_lang/alignas cpp11_lang/alignof cpp11_lang/constexpr
cpp11_lang/noexcept cpp11_lang/thread_local cpp11_lang/literal_op
cpp11_lib/get_new_handler cpp11_lib/max_align_t cpp11_lib/mutex
ts/pmr
env/exception_support env/hosted_implementation
Expand All @@ -22,7 +23,7 @@ comp_target_features(_foonathan_memory_comp_runner INTERFACE
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/foonathan DESTINATION include/comp)

function(_foonathan_use_comp target)
comp_target_features(${target} PRIVATE CPP11)
target_compile_options(${target} PUBLIC ${_foonathan_memory_comp_runner_COMP_COMPILE_OPTIONS})
target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${_foonathan_memory_comp_include_path}>
$<INSTALL_INTERFACE:include/comp>)
endfunction()
2 changes: 2 additions & 0 deletions cmake/configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ set(FOONATHAN_MEMORY_MEMORY_RESOURCE foonathan_comp::memory_resource CACHE STRIN
"the memory_resource class used")
option(FOONATHAN_MEMORY_EXTERN_TEMPLATE
"whether or not common template instantiations are already provided by the library" ON)
set(FOONATHAN_MEMORY_TEMPORARY_STACK_MODE 2 CACHE STRING
"set to 0 to disable the per-thread stack completely, to 1 to disable the nitfy counter and to 2 to enable everything")
2 changes: 1 addition & 1 deletion doc/adapters_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ It does not take ownership, i.e. the passed allocator object must live longer th
* For stateless allocators, it uses a `static` object in order to return a reference in `get_allocator()`.
But this means that they don't actually depend on the lifetime of the given allocator and also can take temporaries.

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

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

0 comments on commit e3d8249

Please sign in to comment.