Re: Valgrind report an error in sample-mdb.c

2014-12-05 Thread Howard Chu

yi huang wrote:

I'm not sure how this happens,


Learn how to use your tools properly.

> ==13010== Use --track-origins=yes to see where uninitialised values 
come from


> is it a problem?

No.



$ make
$ gcc sample-mdb.c -L. -llmdb
$ valgrind ./a.out
==13010== Memcheck, a memory error detector
==13010== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==13010== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==13010== Command: ./a.out
==13010==
==13010== Syscall param pwrite64(buf) points to uninitialised byte(s)
==13010==at 0x42319D3: pwrite (pwrite.c:46)
==13010==by 0x403AB25: mdb_page_flush (mdb.c:3160)
==13010==by 0x4043AD0: mdb_txn_commit (mdb.c:3416)
==13010==by 0x8048A13: main (in
/home/yihuang/src/mdb/libraries/liblmdb/a.out)
==13010==  Address 0x43c35b4 is 4,084 bytes inside a block of size 4,096
alloc'd
==13010==at 0x402BE18: malloc (vg_replace_malloc.c:270)
==13010==by 0x403AE47: mdb_page_malloc.isra.13 (mdb.c:1615)
==13010==by 0x403D281: mdb_page_alloc.isra.22 (mdb.c:2120)
==13010==by 0x403D446: mdb_page_touch (mdb.c:2252)
==13010==by 0x403EEED: mdb_cursor_touch (mdb.c:6019)
==13010==
key: 0x4643fdc 020 , data: 0x4643fe0 020 3141592 foo bar
==13010==
==13010== HEAP SUMMARY:
==13010== in use at exit: 0 bytes in 0 blocks
==13010==   total heap usage: 15 allocs, 15 frees, 1,586,385 bytes allocated
==13010==
==13010== All heap blocks were freed -- no leaks are possible
==13010==
==13010== For counts of detected and suppressed errors, rerun with: -v
==13010== Use --track-origins=yes to see where uninitialised values come
from
==13010== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)




--
  -- Howard Chu
  CTO, Symas Corp.   http://www.symas.com
  Director, Highland Sun http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/



Valgrind report an error in sample-mdb.c

2014-12-05 Thread yi huang
I'm not sure how this happens, is it a problem?

$ make
$ gcc sample-mdb.c -L. -llmdb
$ valgrind ./a.out
==13010== Memcheck, a memory error detector
==13010== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==13010== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==13010== Command: ./a.out
==13010==
==13010== Syscall param pwrite64(buf) points to uninitialised byte(s)
==13010==at 0x42319D3: pwrite (pwrite.c:46)
==13010==by 0x403AB25: mdb_page_flush (mdb.c:3160)
==13010==by 0x4043AD0: mdb_txn_commit (mdb.c:3416)
==13010==by 0x8048A13: main (in
/home/yihuang/src/mdb/libraries/liblmdb/a.out)
==13010==  Address 0x43c35b4 is 4,084 bytes inside a block of size 4,096
alloc'd
==13010==at 0x402BE18: malloc (vg_replace_malloc.c:270)
==13010==by 0x403AE47: mdb_page_malloc.isra.13 (mdb.c:1615)
==13010==by 0x403D281: mdb_page_alloc.isra.22 (mdb.c:2120)
==13010==by 0x403D446: mdb_page_touch (mdb.c:2252)
==13010==by 0x403EEED: mdb_cursor_touch (mdb.c:6019)
==13010==
key: 0x4643fdc 020 , data: 0x4643fe0 020 3141592 foo bar
==13010==
==13010== HEAP SUMMARY:
==13010== in use at exit: 0 bytes in 0 blocks
==13010==   total heap usage: 15 allocs, 15 frees, 1,586,385 bytes allocated
==13010==
==13010== All heap blocks were freed -- no leaks are possible
==13010==
==13010== For counts of detected and suppressed errors, rerun with: -v
==13010== Use --track-origins=yes to see where uninitialised values come
from
==13010== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)