|
From: jee <hou...@gm...> - 2012-09-07 08:51:21
|
hi all: Our code has a bug like this (void*)(u32)(sz_ptr); in 64bit platform! WITHOUT valgrind , malloc alloc memory's address less than 4G. WITHIN valgrind, the replace malloc will alloc memory biger than 4G. and the bug come true. But I can not fix it right now! and can't run the process to check other code. So,Is there a way to make valgrind replace malloc allocate memory less than 4G? |
|
From: John R. <jr...@bi...> - 2012-09-07 12:49:47
|
> (void*)(u32)(sz_ptr); in 64bit platform! > So,Is there a way to make valgrind replace malloc allocate memory less than 4G? No. There is no command-line parameter, environment variable, etc. that will restrict allocations to have an address which is < 4G. In order to implement such a restriction, then you would have to modify the valgrind code that is inside the replace malloc machinery. One possibility is to use the MAP_32BIT flag of mmap(), but this would require the cooperation of valgrind's address space manager. Probably it would be easier fix the bug in "(void*)(u32)(sz_ptr)". Be happy that valgrind found that bug for you! It really is a bug; the app could start failing at any time (any upgrade to glibc, the linux kernel, any shared library used by the app, etc.) even without running valgrind. -- |