Fix some buffers having uninitialized contents after resizing#51
Conversation
sdatkinson
left a comment
There was a problem hiding this comment.
Thanks a lot for doing this! My Linux box has been down for ages and I haven't found time to figure out how to get it resurrected. So I've been missing valgrind dearly on this project.
I think it's worth checking out setZero instead of introducing init_matrix. Mind having a look and either getting back witha revision or letting me know if I'm off-base?
Thanks again!
|
Thanks for your patience. I need a moment to sit down with this and to make sure that the |
|
No problem! But every time you resize the matrix, regardless of whether it needs actual memory allocation or not, the contents of this matrix are no longer valid, right? So before getting referenced (and they are getting referenced after resizing) we need to put something in there. One thing I've ignored is that some matrices might need be initialized with different values, like identity matrix or something pre-determined. And there were some matrices that got filled with something after resizing right away, so obviously I didn't mess with those. |
I used valgrind to test my audio plugin, and it spat out a bunch of warnings like this one:
Apparently a lot of times after matrix or vector gets resized, the memory in those buffers isn't initialized before getting referenced. Which could cause garbage data in audio and ML buffers... This patch fixes it.