Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does Memory Advisor in OMT mode sometimes seem to miss errors reading uninitialized memory?

0
Posted

Why does Memory Advisor in OMT mode sometimes seem to miss errors reading uninitialized memory?

0

By default, Memory Advisor in OMT mode does not report an error when your program copies uninitialized memory from one location to another. This is because C and C++ structures can contain unused padding bytes–space added to the structure to keep the structure’s elements properly aligned for access. When your program copies a structure from one location to another by assignment, it copies all the bytes, including the padding bytes. Therefore, even if your program initializes all members of a structure, Memory Advisor may detect an uninitialized memory access when your program copies the padding bytes. Since this is not a real error, the default behavior of Memory Advisor is to not report an access to uninitialized memory when your program is copying uninitialized memory. Instead, it reports an error if your program reads uninitialized memory without writing it back out.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123