|
From: Benny C. <bwl...@gm...> - 2005-03-22 03:59:31
|
Julian Seward <jseward <at> acm.org> writes: > > Basically it is a mistake to use MAP_FIXED at all, unless you have > complete control of the address space. Which, in almost all programs > you don't. A few years ago I worked on a project which did this, and > our program started to fail on obscure Linux distros. We realised > our mistake and reworked it to get rid of MAP_FIXED. > > J Thanks Julian. I have changed the mmap() back to malloc(), and the program can run under Valgrind, but with such errors: ==5504== Syscall param write(buf) contains uninitialised or unaddressable byte (s) ==5504== at 0x1BACA743: __write_nocancel (in /mnt/nfsroot/lib/tls/libc- 2.3.2.so) ==5504== by 0x1BA65D4D: new_do_write (in /mnt/nfsroot/lib/tls/libc-2.3.2.so) ==5504== by 0x1BA66F3F: _IO_file_xsputn@@GLIBC_2.1 (in /mnt/nfsroot/lib/tls/libc-2.3.2.so) ==5504== by 0x1BA5C2CE: _IO_fwrite_internal (in /mnt/nfsroot/lib/tls/libc- 2.3.2.so) ==5504== Address 0x1C83E028 is 294912 bytes inside a block of size 268435456 alloc'd ==5504== at 0x1B903D48: malloc (vg_replace_malloc.c:131) ==5504== by 0x8054F38: dm_init() (dsmmem.cpp:181) ==5504== by 0x804931D: main (dsminit-add.cpp:123) <Program Execution Continues for some time...> valgrind: vg_memory.c:229 (vgPlain_unmap_range): Assertion `rs == s' failed. ==5504== at 0xB002A954: vgPlain_skin_assert_fail (vg_mylibc.c:1137) ==5504== by 0xB002A953: assert_fail (vg_mylibc.c:1133) ==5504== by 0xB002A991: vgPlain_core_assert_fail (vg_mylibc.c:1144) ==5504== by 0xB0028238: vgPlain_unmap_range (vg_memory.c:245) sched status: Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0 ==5504== at 0x52BFF042: ??? ==5504== by 0x1BA65569: _IO_file_close_it@@GLIBC_2.1 (in /mnt/nfsroot/lib/tls/libc-2.3.2.so) ==5504== by 0x1BA5AF38: _IO_fclose@@GLIBC_2.1 (in /mnt/nfsroot/lib/tls/libc- 2.3.2.so) ==5504== by 0x804C21F: swapoutobj(int, int, int, int, int) (dsm.h:836) Note: see also the FAQ.txt in the source distribution. It contains workarounds to several common problems. If that doesn't help, please report this bug to: valgrind.kde.org In the bug report, send all the above text, the valgrind version, and what Linux distro you are using. Thanks. I am particularly concerned about the error message "Address 0x1C83E028 is 294912 bytes inside a block of size 268435456 alloc'd". Seems the malloc() gives me a chunk of memory already allocated in another malloc()'ed chunk. Does it suggest that Valgrind has some problems under the Linux version I am using? I am using Fedora core 1. Thanks and Best Regards, Benny. |