Repository navigation
Solve memory leak to fix issue #7210 - #7247
Conversation
…ove memory leaks.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
|
@ysheffer thank you for submitting this to the Numba issue tracker. It seems like your PR is doing a lot of cosmetics to the code in addition to implementing the feature. Do you think you could submit this PR with only the feature and not the cosmetics, as this makes it harder to review. Thanks! |
Redefined MOD_INIT sections in _num_threads.c, _omppool.cpp, tbbpool.cpp, workqueue.c.
|
@esc Thank you for your comment. Sure thing, I have updated the PR accordinaglly. |
|
@ysheffer thank you for making those changes, I have added it to the queue for review. |
| #define PyInt_Check PyLong_Check | ||
| #define PyInt_CheckExact PyLong_CheckExact | ||
| // Define object attribute using a temporary variable to avoid memory leak | ||
| #define SetAttrStringFromVoidPointer(m, name, tmp) \ |
There was a problem hiding this comment.
I think you had better wrap these three lines with a do { } while (false) block and declare a temporary variable in the block instead of using an external variable.
There was a problem hiding this comment.
This is now applied, but I used while (0) instead of while (false) because false is not defined everywhere the macro is used.
stuartarchibald
left a comment
There was a problem hiding this comment.
@ysheffer Many thanks for the patch, couple of minor things to look at else looks good.
| #define PyInt_Check PyLong_Check | ||
| #define PyInt_CheckExact PyLong_CheckExact | ||
| // Define object attribute using a temporary variable to avoid memory leak | ||
| #define SetAttrStringFromVoidPointer(m, name, tmp) \ |
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
This avoids it needing to have a temp passed in. Formatting is also altered slightly to match that of existing code.
|
@stuartarchibald This should be ready for another look now. |
|
@ysheffer Congratulations on your first contribution to Numba! |
Added a macro to _pymodule.h and set attributes in _num_threads.c, _omppool.cpp,
tbbpool.cpp, workqueue.c using a temporary variable to solve memory leak and fix #7210 .