|
From: sbssmadhav (s. by Nabble.com) <li...@na...> - 2005-12-15 22:48:34
|
Hi: A server application I am developing is reporting of System call write(buf) points to unitiialized byte(s) error when run through valgrind. It happens on a char* that is allocated and later memset to '\0' and partially (or fully) filled in later and sent across the network with a write(socket, buf, len). The only explaination on valgrind website about if the memory being used is not initialised, however, I believe the memory is being initialized! What else could be causing this problem. It also says "Address 0x..... is 4 bytes inside a block of 1024 alloc'd", what does this really mean? I have not seen a good explaination of this statement anywhere!! Any help is much appreciated. Thanks a googol. Best, --Madhav -- Sent from the Valgrind - Users forum at Nabble.com: http://www.nabble.com/write%28buf%29-uninitialised-byte%28s%29-t751866.html#a1966214 |
|
From: Tom H. <to...@co...> - 2005-12-15 23:59:05
|
In message <196...@ta...>
"sbssmadhav (sent by Nabble.com)" <li...@na...> wrote:
> A server application I am developing is reporting of System call write(buf)
> points to unitiialized byte(s) error when run through valgrind. It happens
> on a char* that is allocated and later memset to '\0' and partially (or
> fully) filled in later and sent across the network with a write(socket,
> buf, len). The only explaination on valgrind website about if the memory
> being used is not initialised, however, I believe the memory is being
> initialized!
You've initialised it all to zero, byt then you have copied in other
things and if any of those were uninitialised then the relevant part
of the buffer will then be uninitialised.
> What else could be causing this problem. It also says "Address 0x..... is 4
> bytes inside a block of 1024 alloc'd", what does this really mean? I have
> not seen a good explaination of this statement anywhere!! Any help is much
> appreciated. Thanks a googol.
It means that the address of the first uninitialised byte is the
address given and is four bytes from the start of the block in
question - a block whose total size is 1024 bytes.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: sbssmadhav (s. by Nabble.com) <li...@na...> - 2005-12-16 06:43:04
|
super, that is indeed true. i was copying values from a struct into this "buf" and one of the values in the struct was uninitialized!!! thanks a googol. i appreciate your help. --Madhav -- Sent from the Valgrind - Users forum at Nabble.com: http://www.nabble.com/write%28buf%29-uninitialised-byte%28s%29-t751866.html#a1969817 |