|
From: Salim S. <ssa...@ti...> - 2003-11-24 11:16:53
|
> > ==21866== Invalid read of size 4 > > ==21866== at 0x402702E4: JudySLIns (src/JudySL/JudySL.c:630) > > ==21866== by 0x8048789: main (judySL_test.c:20) > > ==21866== by 0x40296686: __libc_start_main (../sysdeps/generic/libc-start.c:129) > > ==21866== by 0x8048630: (within /home/ocadmin/salim/lab_RD/a.out) > > ==21866== Address 0x40D35020 is 4 bytes before a block of size 7 alloc'd > > ==21866== at 0x4002BB60: malloc (vg_replace_malloc.c:153) > > ==21866== by 0x40270009: JudySLIns (src/JudySL/JudySL.c:552) > > ==21866== by 0x8048789: main (judySL_test.c:20) > > ==21866== by 0x40296686: __libc_start_main (../sysdeps/generic/libc-start.c:129) > > ==21866== > > ==21866== Invalid free() / delete / delete[] > > ==21866== at 0x4002BE5B: free (vg_replace_malloc.c:231) > > ==21866== by 0x40270378: JudySLIns (src/JudySL/JudySL.c:639) > > ==21866== by 0x8048789: main (judySL_test.c:20) > > ==21866== by 0x40296686: __libc_start_main (../sysdeps/generic/libc-start.c:129) > > ==21866== Address 0x40D35020 is 4 bytes before a block of size 7 alloc'd > > ==21866== at 0x4002BB60: malloc (vg_replace_malloc.c:153) > > ==21866== by 0x40270009: JudySLIns (src/JudySL/JudySL.c:552) > > ==21866== by 0x8048789: main (judySL_test.c:20) > > ==21866== by 0x40296686: __libc_start_main (../sysdeps/generic/libc-start.c:129) > > File 'judySL_test.c', line 20: JudySLIns(), JU_ERRNO_* == 7, ID == 396 > > Assuming your test program isn't buggy, > you may have found a bug in the Judy library. > Either way, you probably want to take this up on the Judy mailing list... > - Dan It seems that the pointers used in Judy array are aligned on 8 bytes! And launching valgrind with the option --alignment=8 solves the problem. This paragraph, from "Judy IV Shop Manual", explains the mystery: ---------------------------------------------------------------------------- ------------ 4.2 Judy Array Pointer (JAP): A Judy Array Pointer (root pointer) is 1 word = 4 bytes [8 bytes] containing an ordinary pointer (memory address) that points to a Judy array, except that it always references an object aligned to at least a 2-word = 8-byte [16-byte] boundary. Hence the 3 [or 4] least significant bits of the root pointer would always be 0, and are usable to encode the type of object to which the root pointer points. [In fact only the least 3 bits are needed and used, even on 64-bit systems.] Best regards, __salim |