-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
BUG: Need to fill buffer for R and Python interfaces. #1699
Conversation
damn - that's a classic one and hard to "see" ... |
guess it also raises the question of where else this may occur ..... |
There's a few other instances of Allocate() not followed by FillBuffer, looks like mostly in ImageMath. There's also some code that calls Is there an explanation of how this works? It seems the uninitialized data is all internal to the C++ code, why does it not cause non-deterministic behavior when run directly? |
my understanding ( from itk discussions ) is the C++ standard does not define expectations for values within uninitialized memory; such values are indeterminate, and accessing them leads to undefined behavior. ... not sure if itk Allocate is supposed to behave differently though |
To fix this common issue itk has been transitioning to a single call for both |
Thanks @gdevenyi - so it looks like we could replace Allocate() with Allocate(true) or, as of that PR, AllocateInitialized() and solve this problem consistently. |
yes - worthwhile. would also need to check all the R c++ and python c++ ( not much in the latter , I think ) .... another issue is I have not updated pybind11 in some time .... not sure if this would be related or not. |
I'll go ahead and merge this and a future pull can address the more general presence of this issue. |
Unless somebody else wants to do it, I can put it on my to-do list to go through and check that the image buffer is initialized. |
Thanks Nick, much appreciated. I'll make some issues so we can keep track of this |
Thanks @cookpa . But just to be clear, it might take a couple days to a week. |
ANTsX/ANTsPy#579