-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix uninitialized memory in TParameter::copy and added unit-test #1892
Conversation
lambday
commented
Feb 25, 2014
- added a automagic unit test for DynamicObjectArray (non empty) for all CSGObjects
@karlnapf @sonney2k @vigsterkr please have a look! |
valgrind reveals that we have leak while using DynamicObjectArray of KernelPCA and VwRegressor, rest works fine! |
/* check whether ptype is SGOBJECT, if yes we need to initialize | ||
the memory with NULL for the way copy_ptype handles it */ | ||
if (m_datatype.m_ptype==PT_SGOBJECT) | ||
memset(*(void**)target->m_parameter, 0, num_bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! :)
So, is there a unit test to make this waterproof? Since all tests were green before... ?
@lambday ah nice, I see, great work with this array unit test. One thing I would like to see though is some more low level tests, have a look into the parameter tests, there is an explicit test for every case in copy_ptype. This should be extended to SG_VECTOR/SG_MATRIX where the primitive is sgobject. But I will merge this for now, could you add these tiny tests also? Thanks a ton on this! |
fix uninitialized memory in TParameter::copy and added unit-test
@votjakovr does this fix the issues you had? |
@votjakovr my pleasure! The example you had works fine locally :) |