-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Disclaimer I run an "old" gcc compiler so maybe that's the problem, but I still thought I would share.
Note, it seems like -DRECORD_MALLOCS causes a failure scenario on my system with the "malloced_roaring_benchmarks" if it is compiled as per the default in the Makefile.
malloced_roaring_benchmarks : src/roaring.c src/roaring_benchmarks.c
$(CC) $(CFLAGS) -o malloced_roaring_benchmarks src/roaring_benchmarks.c -DRECORD_MALLOCS
If I remove the flag -DRECORD_MALLOCS from the Makefile the make file everything works.
malloced_roaring_benchmarks : src/roaring.c src/roaring_benchmarks.c
$(CC) $(CFLAGS) -o malloced_roaring_benchmarks src/roaring_benchmarks.c
The following is what happens if I leave -DRECORD_MALLOCS active, e.g. the failure mode. On another note, should we actually doing benchmarks while recording allocated memory anyway by default ?
We experience a "Segmentation Fault" on the call to libc_malloc(...) on line 15 of this header file "src/cmemcounter.h" which is used to track memory - usage perhaps this is not entirely safe
void* malloc(size_t sz) {
void *(*libc_malloc)(size_t) = dlsym(RTLD_NEXT, "malloc");
void * answerplus = libc_malloc(sz + sizeof(size_t) + sizeof(myalloc_cookie) );
My Server config (recent SmartOS VM with a zone limited to just 4GB, gcc 4.7.4):
# uname -a
SunOS gcc01 5.11 joyent_20180118T013028Z i86pc i386 i86pc Solaris
# gcc -v
Using built-in specs.
COLLECT_GCC=/opt/local/gcc47/bin/gcc
COLLECT_LTO_WRAPPER=/opt/local/gcc47/libexec/gcc/i486-sun-solaris2.11/4.7.4/lto-wrapper
Target: i486-sun-solaris2.11
Configured with: ../gcc-4.7.4/configure --enable-languages='c obj-c++ objc go fortran c++' --enable-shared --enable-long-long --with-local-prefix=/opt/local --enable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc++ -static-libgcc -Wl,-R/opt/local/lib ' --disable-nls --with-gxx-include-dir=/opt/local/gcc47/include/c++/ --without-gnu-ld --with-ld=/usr/bin/ld --with-gnu-as --with-as=/opt/local/bin/gas --prefix=/opt/local/gcc47 --build=i486-sun-solaris2.11 --host=i486-sun-solaris2.11 --infodir=/opt/local/gcc47/info --mandir=/opt/local/gcc47/man
Thread model: posix
gcc version 4.7.4 (GCC)
# prtconf | head -3 | grep Mem
prtconf: devinfo facility not available
Memory size: 4096 Megabytes
In order to get things to compile (old gcc/g++ stack) I changed the following three (3) files:
vi ./Makefile
alter both CFLAGS and CXXLAGS
remove:
-Wno-deprecated-register
add:
-m64
vi ./src/benchmark.h
add:
#include <getopt.h>
#ifdef __cplusplus
#include <stdexcept>
#endif
vi ./synthetic/anh_moffat_clustered.h
add:
#include <stdexcept>
It seems all the runs of ./malloced_roaring_benchmarks fail with a Segmentation Fault except one which hangs (or seems to hang) this exception is census1881_srt. I will only show what happens for the more typical Segmentation Fault case.
# ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-income
Segmentation Fault (core dumped)
Running the the same command above under truss
# truss ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-income |& tail -20
fstat(3, 0xFFFFFD7FFFDFF6C0) = 0
ioctl(3, TCGETA, 0xFFFFFD7FFFDFF740) Err#25 ENOTTY
read(3, " 2 , 1 8 , 7 9 , 1 4 2 ,".., 44544) = 44363
lseek(3, 0, SEEK_CUR) = 44363
close(3) = 0
open("CRoaring/benchmarks/realdata/census-income/census-income.csv99.txt", O_RDONLY) = 3
lseek(3, 0, SEEK_END) = 64307
lseek(3, 0, SEEK_CUR) = 64307
lseek(3, 0, SEEK_CUR) = 64307
lseek(3, 0, SEEK_SET) = 0
fstat(3, 0xFFFFFD7FFFDFF790) = 0
fstat(3, 0xFFFFFD7FFFDFF6C0) = 0
ioctl(3, TCGETA, 0xFFFFFD7FFFDFF740) Err#25 ENOTTY
read(3, " 2 6 , 4 0 , 4 7 , 5 1 ,".., 64512) = 64307
lseek(3, 0, SEEK_CUR) = 64307
close(3) = 0
Incurred fault #6, FLTBOUNDS %pc = 0xFFFFFD7FEF229C41
siginfo: SIGSEGV SEGV_MAPERR addr=0xFFFFFD7FEF229C41
Received signal #11, SIGSEGV [default]
siginfo: SIGSEGV SEGV_MAPERR addr=0xFFFFFD7FEF229C41
[root@gcc01 /opt/jon/wrk/CBitmapCompetition]#
looking at the generated core file in this case "core.malloced_roaring.89085"
# file core.malloced_roaring.89085
core.malloced_roaring.89085: ELF 64-bit LSB core file AMD64 Version 1, from 'malloced_roarin'
# ls -ltr core.malloced_roaring.89085
-rw------- 1 root root 32209219 Feb 15 20:15 core.malloced_roaring.89085
# pargs core.malloced_roaring.89085
core 'core.malloced_roaring.89085' of 89085: ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-income
argv[0]: ./malloced_roaring_benchmarks
argv[1]: -r
argv[2]: CRoaring/benchmarks/realdata/census-income
# pstack core.malloced_roaring.89085
core 'core.malloced_roaring.89085' of 89085: ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-i
fffffd7fef229c41 t_splay (7c9390) + 11
fffffd7fef229ad6 t_delete (7c9390) + 26
fffffd7fef229801 realfree (7ad220) + 141
fffffd7fef229f3a cleanfree (0) + 3a
fffffd7fef229090 _malloc_unlocked (12) + 60
fffffd7fef228ffb malloc (12) + 3b
000000000040bcc5 malloc () + 25
0000000000414f5a array_container_grow () + 6a
000000000042014a roaring_bitmap_add_many () + e2a
0000000000420300 roaring_bitmap_of_ptr () + 30
000000000042d714 main () + 1374
000000000040b933 _start_crt () + 83
000000000040b898 _start () + 18
# pflags core.malloced_roaring.89085
core 'core.malloced_roaring.89085' of 89085: ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-i
data model = _LP64 flags = MSACCT|MSFORK
/1: flags = 0
sigmask = 0xffffbefc,0xffffffff,0x000003ff
cursig = SIGSEGV
# pldd core.malloced_roaring.89085
core 'core.malloced_roaring.89085' of 89085: ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-i
/lib/amd64/libdl.so.1
/lib/amd64/libc.so.1
# pmap core.malloced_roaring.89085
core 'core.malloced_roaring.89085' of 89085: ./malloced_roaring_benchmarks -r CRoaring/benchmarks/realdata/census-i
0000000000400000 204K r-x-- /opt/jon/wrk/CBitmapCompetition/malloced_roaring_benchmarks
0000000000442000 24K rw--- /opt/jon/wrk/CBitmapCompetition/malloced_roaring_benchmarks
0000000000448000 28512K rw--- [ heap ]
FFFFFD7FECB6F000 4K r-x-- /lib/amd64/libdl.so.1
FFFFFD7FEF130000 64K rwx-- [ anon ]
FFFFFD7FEF150000 24K rwx-- [ anon ]
FFFFFD7FEF160000 4K rwx-- [ anon ]
FFFFFD7FEF170000 4K rwx-- [ anon ]
FFFFFD7FEF180000 1548K r-x-- /lib/amd64/libc.so.1
FFFFFD7FEF313000 48K rw--- /lib/amd64/libc.so.1
FFFFFD7FEF31F000 16K rw--- /lib/amd64/libc.so.1
FFFFFD7FEF330000 4K rwx-- [ anon ]
FFFFFD7FEF340000 4K r----* [ anon ]
FFFFFD7FEF350000 4K rwx-- [ anon ]
FFFFFD7FEF360000 4K rw--- [ anon ]
FFFFFD7FEF370000 4K rw--- [ anon ]
FFFFFD7FEF380000 4K rwx-- [ anon ]
FFFFFD7FEF390000 4K r----* [ anon ]
FFFFFD7FEF397000 332K r-x-- /lib/amd64/ld.so.1
FFFFFD7FEF3FA000 12K rwx-- /lib/amd64/ld.so.1
FFFFFD7FEF3FD000 8K rwx-- /lib/amd64/ld.so.1
FFFFFD7FFFDFD000 12K rw--- [ stack ]
total 30844K