While undocumented, the prctl system call will set errno to ENOMEM
when passed NULL as an address. Under that condition, an assertion
that check for EINVAL as the only possible errno value will fail. To
avoid the assertion failure, this change skips the call to os_page_id
when address is NULL. NULL can only occur after mmap fails in which
case there is no mapping to name.
When C++ support is enabled, configure unconditionally probes
`-lstdc++` and keeps it in LIBS if the link test succeeds. On
platforms using libc++, this probe can succeed at compile time (if
libstdc++ headers/libraries happen to be installed) but then cause
runtime failures when configure tries to execute test binaries
because `libstdc++.so.6` isn't actually available.
Add a `--with-cxx-stdlib=<libstdc++|libcxx>` option that lets the
build system specify which C++ standard library to link. When given,
the probe is skipped and the specified library is linked directly.
When not given, the original probe behavior is preserved.
Add mechanism to be able to select a test to run from a test file. The test harness will read the JEMALLOC_TEST_NAME env and, if set, it will only run subtests with that name.
The definition of the PAGE_SIZE macro is used as a signal for a 32-bit
target or a 64-bit target with an older NDK. Otherwise, a 16KiB page
size is assumed.
Closes: #2657
The address of the local variable created_threads is a different
location than the data it points to. Incorrectly treating these
values as being the same can cause out-of-bounds writes to the stack.
Closes: facebook/jemalloc#59
Next to its use, which is always as an argument, we include the name
of the parameter in a constant. This completes a partially
implemented cleanup suggested in an earlier commit.
The configure.ac script uses backslash plus in its grep patterns to
match one or more occurrences. This is a GNU grep extension to the
Basic Regular Expressions syntax that fails on systems with a more
traditional grep. This changes fixes grep patterns that use backslash
plus to use a star instead.
Closes: #2777
This change replaces direct comparisons of Pthread thread IDs with
calls to pthread_equal. Directly comparing thread IDs is neither
portable nor reliable since a thread ID is defined as an opaque type
that can be implemented using a structure.
This updates the configuration script to set the default page size to
64KiB on Aarch64 Linux. This is motivated by compatibility as a build
configured for a 64KiB page will work on kernels that use the smaller
4KiB or 16KiB pages, whereas the reverse is not true.
To make the configured page size setting more visible, the script now
displays the page size when printing the configuration results.
Users that want to override the page size in to choose a smaller value
can still do so with the --with-lg-pagesize configuration option.
The static inline definition made more sense when these functions just
dispatched to a syscall wrapper. Since they acquired a retry loop, a
non-inline definition makes more sense.
An include of unistd.h is needed to make the declaration of the
syscall function visible to the compiler. The include of sys/mman.h
is not used at all.
When the dehugify functionality was retired in an previous commit, a
dehugify-related function and global variable in a test was
accidentally left in-place causing builds that add -Werror to CFLAGS
to fail.
Giving the advice MADV_DONTNEED to a range of virtual memory backed by
a transparent huge page already causes that range of virtual memory to
become backed by regular pages.