The bootstrapping allocator needs to perform a memcpy to bypass the
removed move constructors on std::atomic. This is safe as there is no
concurrency at this point, but GCC is unhappy with this.
This commit moves CI to GCC8 and disables this warning for that line.
The readme was considerably out of date, with the introduction
being over a year old. This commit reflects the developments and
improvements in stabiity of snmalloc.
On platforms that support low-memory notifications register callbacks
that perform lazy decommit. This allows idle processes to return memory
to the OS. Without incurring the cost of constantly committing and
decommitting memory.
Code review and CI changes
* Fixed test to use a template to make constexpr magic work
* Factored out basic notification mechanism so can be reused on other
platforms.
If the external thread statics are used, then
we don't need to include some C++ runtime
concepts. This refactoring moves some global initialization under
conditional compilation.
With clangformat9 the AfterCaseLabel is introduced.
And this defaults to false, but our code is formatted
implicitly with this set to true.
PRs to Verona and Snmalloc are being formatted with clangformat9,
and this is causing complexity. Let's move forward to clangformat9
in CI.
Windows is only sending low-memory notifications when the machine
is reaching low-memory. So running a 32bit process on 64bit machine
can easily exhaust address space before machine gets close to
low-memory.
The low-memory notification was getting into an infinite loop. This
fixes the loop termination, and provides a test for platforms which
support low-memory notification.
On platforms that do not support aligned mmap/VirtualAlloc,
we need to produce heavily aligned blocks to guarantee we can meet
all possible alignment requests.
This commit grabs a block much larger than requested, and then produces
"offcuts" before and after the block of smaller/same "large_classes". This
enables one mmap/virtual alloc request to services many other requests
for aligned memory.
The PAL API previously allowed for returning more memory than asked for.
This was when the PAL performed the alignment work, now this is done in
large alloc, so removing from the PAL.
* Removing option as not supported by CI
Will migrate CI forward and readd.
* Made failure for clang-format errors.
* Improved handling of errors during CI.
* Prevent failures escaping.
* Clang-format fix
* Remove stderr
* Update azure-pipelines.yml
Co-Authored-By: Paul Liétar <plietar@users.noreply.github.com>
Co-authored-by: Paul Liétar <plietar@users.noreply.github.com>
find_program can do that for us. Additionally that loop was resetting
the CLANG_FORMAT every time ninja was run, making it impossible to
pass a specific -DCLANG_FORMAT=... to cmake.
I've tried version 6 to 8 and formatting remains stable. clang 9 is
when it breaks down because of AfterCaseLabel.
The performance on Windows was significantly regressed by the
notify_using during the bump allocation. This change removes that.
It appears that the pages are already committed by
the large allocator.
Fixes a few places where Clang complains about Windows specific code,
and also uses macros supported by Clang on Windows. A few places
separating platform and compiler specific code, as MSVC and WIN32 were
used interchangably previously.
* add rust support
* move aligned_size to sizeclass.h
* add static qualifier
* adjust CMakeLists.txt, may broke CI tests
* fix msvc's complaining on c++17
* use SNMALLOC_FAST_PATH as the decorator of aligned_size
* adapt new alignment algorithm and add related test
Co-authored-by: mjp41 <mattpark@microsoft.com>
* fix test cases for msvc
* add extra test for size == 0
* treat memory block of same sizeclass as the same
* fix formatting problem
* remove extra declarations
Co-authored-by: Matthew Parkinson <mjp41@users.noreply.github.com>
For languages like Verona or Rust, the deallocation calls know the
size of the object originally requested. This change optimises that
code path to create a much better fast path.