|
From: Konstantin S. <kon...@gm...> - 2010-03-10 09:55:47
|
I submitted https://bugs.kde.org/show_bug.cgi?id=229500 Any hope? On Thu, Mar 4, 2010 at 2:55 PM, Konstantin Serebryany <kon...@gm...> wrote: > Hi, > > I have a program (on 64-bit linux) which does mmap(0, 84G, ...). > When running natively, it works perfectly. Under valgrind it fails. > Any idea why? > > % cat mmap_test.c > #include <stdint.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > #include <sys/mman.h> > #include <unistd.h> > #include <errno.h> > #include <string.h> > #include <stdio.h> > > int main() { > size_t size = (1ULL << 32) * 21; // 21 * 4G > void *mem_ptr = mmap((void *) 0, > size, > PROT_EXEC | PROT_READ | PROT_WRITE, > MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, > -1, > (off_t) 0); > printf("res=%p\n", mem_ptr); > return 0; > } > % gcc mmap_test.c -m64 && ./a.out && > ~/valgrind/trunk/inst/bin/valgrind --tool=none -q ./a.out > res=0x7f4fd9019000 > res=0xffffffffffffffff > > > Thanks, > > --kcc > > P.S. Allocating 84G of memory is not insane. We need a chunk of memory > with huge guard pages around it. If curious, this code is a part of > Native Client. > |