Skip to content

Commit

Permalink
Finish release 0.5-2
Browse files Browse the repository at this point in the history
  • Loading branch information
foonathan committed Apr 13, 2016
2 parents d3ee8f8 + 1cf9079 commit a86588b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ 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 .
- ./test/foonathan_memory_test
- ./test/foonathan_memory_test
- ./test/foonathan_memory_profiling 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ In addition:
## Basic example

```cpp
include <algorithm>
#include <algorithm>
#include <iostream>
#include <iterator>

Expand Down
2 changes: 1 addition & 1 deletion doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The concepts of this library are defined are [here](md_doc_concepts.html).
## Basic example

```cpp
include <algorithm>
#include <algorithm>
#include <iostream>
#include <iterator>

Expand Down
3 changes: 2 additions & 1 deletion src/detail/free_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ void* ordered_free_memory_list::allocate(std::size_t n) FOONATHAN_NOEXCEPT
xor_list_change(i.next, i.last, i.prev); // change prev pointer from i.next to i.prev
capacity_ -= i.size(actual_size);

if (less(i.prev, last_dealloc_) && less(last_dealloc_, i.next))
// if last_dealloc_ points into the array being removed
if (less_equal(i.first, last_dealloc_) && less_equal(last_dealloc_, i.last))
{
// move last_dealloc just outside range
last_dealloc_ = i.next;
Expand Down
10 changes: 10 additions & 0 deletions src/detail/free_list_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ namespace foonathan { namespace memory
#endif
}

inline bool less_equal(void *a, void *b) FOONATHAN_NOEXCEPT
{
return a == b || less(a, b);
}

inline bool greater(void *a, void *b) FOONATHAN_NOEXCEPT
{
#if FOONATHAN_HOSTED_IMPLEMENTATION
Expand All @@ -130,6 +135,11 @@ namespace foonathan { namespace memory
return to_int(a) < to_int(b);
#endif
}

inline bool greater_equal(void *a, void *b) FOONATHAN_NOEXCEPT
{
return a == b || greater(a, b);
}
} // namespace detail
}} // namespace foonathan::memory

Expand Down
6 changes: 4 additions & 2 deletions src/detail/small_free_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,10 @@ chunk* small_free_memory_list::find_chunk_impl(std::size_t n) FOONATHAN_NOEXCEPT
return c;

cur_forward = cur_forward->next;
cur_backward = cur_backward->next;
} while (cur_forward != cur_backward);
cur_backward = cur_backward->prev;
FOONATHAN_MEMORY_ASSERT(cur_forward != alloc_chunk_);
FOONATHAN_MEMORY_ASSERT(cur_backward != alloc_chunk_);
} while (true);
FOONATHAN_MEMORY_UNREACHABLE("there is memory available somewhere...");
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ std::size_t measure(F func, Args&&... args)
return std::size_t(duration.count());
}

const std::size_t sample_size = 1024u;
std::size_t sample_size = 1024u;

template<typename F, typename Alloc, typename ... Args>
std::size_t benchmark(F measure_func, Alloc make_alloc, Args&& ... args)
Expand Down
5 changes: 4 additions & 1 deletion test/profiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ void benchmark_array(std::initializer_list<std::size_t> counts,
benchmark_array<Second, Tail...>(counts, node_sizes, array_sizes);
}

int main()
int main(int argc, char *argv[])
{
if (argc >= 2)
sample_size = std::size_t(std::atoi(argv[1]));

class comma_numpunct : public std::numpunct<char>
{
protected:
Expand Down

0 comments on commit a86588b

Please sign in to comment.