1
0
mirror of https://github.com/fluencelabs/redis synced 2025-06-22 21:41:32 +00:00
Files
.github
deps
hiredis
jemalloc
bin
build-aux
doc
include
m4
msvc
scripts
src
test
include
integration
cpp
MALLOCX_ARENA.c
aligned_alloc.c
allocated.c
extent.c
extent.sh
mallocx.c
mallocx.sh
overflow.c
posix_memalign.c
rallocx.c
sdallocx.c
thread_arena.c
thread_tcache_enabled.c
xallocx.c
xallocx.sh
src
stress
unit
test.sh.in
.appveyor.yml
.autom4te.cfg
.gitattributes
.gitignore
.travis.yml
COPYING
ChangeLog
INSTALL.md
Makefile.in
README
TUNING.md
VERSION
autogen.sh
config.stamp.in
configure
configure.ac
jemalloc.pc.in
run_tests.sh
linenoise
lua
Makefile
README.md
update-jemalloc.sh
src
tests
utils
.gitignore
00-RELEASENOTES
BUGS
CONTRIBUTING
COPYING
INSTALL
MANIFESTO
Makefile
README.md
TLS.md
redis.conf
runtest
runtest-cluster
runtest-moduleapi
runtest-sentinel
sentinel.conf
redis/deps/jemalloc/test/integration/overflow.c

47 lines
1.3 KiB
C
Raw Normal View History

2015-10-06 16:18:30 +02:00
#include "test/jemalloc_test.h"
2018-05-24 17:17:37 +02:00
TEST_BEGIN(test_overflow) {
unsigned nlextents;
2015-10-06 16:18:30 +02:00
size_t mib[4];
size_t sz, miblen, max_size_class;
void *p;
sz = sizeof(unsigned);
2018-05-24 17:17:37 +02:00
assert_d_eq(mallctl("arenas.nlextents", (void *)&nlextents, &sz, NULL,
0), 0, "Unexpected mallctl() error");
2015-10-06 16:18:30 +02:00
miblen = sizeof(mib) / sizeof(size_t);
2018-05-24 17:17:37 +02:00
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
2015-10-06 16:18:30 +02:00
"Unexpected mallctlnametomib() error");
2018-05-24 17:17:37 +02:00
mib[2] = nlextents - 1;
2015-10-06 16:18:30 +02:00
sz = sizeof(size_t);
2018-05-24 17:17:37 +02:00
assert_d_eq(mallctlbymib(mib, miblen, (void *)&max_size_class, &sz,
NULL, 0), 0, "Unexpected mallctlbymib() error");
2015-10-06 16:18:30 +02:00
assert_ptr_null(malloc(max_size_class + 1),
"Expected OOM due to over-sized allocation request");
assert_ptr_null(malloc(SIZE_T_MAX),
"Expected OOM due to over-sized allocation request");
assert_ptr_null(calloc(1, max_size_class + 1),
"Expected OOM due to over-sized allocation request");
assert_ptr_null(calloc(1, SIZE_T_MAX),
"Expected OOM due to over-sized allocation request");
p = malloc(1);
assert_ptr_not_null(p, "Unexpected malloc() OOM");
assert_ptr_null(realloc(p, max_size_class + 1),
"Expected OOM due to over-sized allocation request");
assert_ptr_null(realloc(p, SIZE_T_MAX),
"Expected OOM due to over-sized allocation request");
free(p);
}
TEST_END
int
2018-05-24 17:17:37 +02:00
main(void) {
return test(
test_overflow);
2015-10-06 16:18:30 +02:00
}