Updated:
now with valgrind --tools=memcheck --track-origins=yes --leak-check=full ./prog
it runs correctly, but without this valgrind
, it still goes wrong, how's that happen?
I'm doing a project on Linux, which stores lots of data in memory, and I need to know which data block is changed in order to find out the problem in my program.
Updated: This is a multithread program, and the write/read is done by different threads which created by system calls.
The code is like this
for(j=0;j<save_size;j++){
e->blkmap_mem[blk_offset+save_offset + j] = get_mfs_hash_block();
memcpy(e->blkmap_mem[blk_offset + save_offset +j]->data, (char *)buff + j * 4096, 4096);
e->blkmap_mem[save_offset+j]->data = (char *)(buff + j* 4096);
e->blkmap_mem[blk_offset+save_offset + j]->size = 4096;
e->blkmap_addr[blk_offset+save_offset + j] = 1;
And I want to know if e->blkmap_mem[blk_offset+save_offset+j]->data
is changed in somewhere else.
I know awatch exp
in gdb
could check if the value changes, but there are too many here, is there some way to trace them all, I mean they may be nearly 6,000.
Thanks your guys.