-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Free dynamically allocated memory prior to returning error #62570
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I build pandas with # t.py
import numpy as np
from pandas._libs.hashing import hash_object_array
arr = np.array(["hello", None, "world", 42], dtype=object)
key = "1234567890123456"
hash_object_array(arr, key) Executed it with LD_PRELOAD=/usr/lib64/libasan.so.8 python t.py And in the errors there is
Line 5942 /* "pandas/_libs/hashing.pyx":70
*
* # create an array of bytes
* vecs = <char **>malloc(n * sizeof(char *)) # <<<<<<<<<<<<<<
* if vecs is NULL:
* raise MemoryError()
*/
__pyx_v_vecs = ((char **)malloc((__pyx_v_n * (sizeof(char *))))); Line 5979 /* "pandas/_libs/hashing.pyx":73
* if vecs is NULL:
* raise MemoryError()
* lens = <uint64_t*>malloc(n * sizeof(uint64_t)) # <<<<<<<<<<<<<<
* if lens is NULL:
* raise MemoryError()
*/
__pyx_v_lens = ((__pyx_t_5numpy_uint64_t *)malloc((__pyx_v_n * (sizeof(__pyx_t_5numpy_uint64_t))))); Good catch! |
mroeschke
approved these changes
Oct 4, 2025
Thanks @zjweiss-google |
:) happy to help
…On Sat, Oct 4, 2025, 9:27 AM Matthew Roeschke ***@***.***> wrote:
*mroeschke* left a comment (pandas-dev/pandas#62570)
<#62570 (comment)>
Thanks @zjweiss-google <https://github.com/zjweiss-google>
—
Reply to this email directly, view it on GitHub
<#62570 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BYILKHLTNIBACFYLMJZ2MY33V7YQ5AVCNFSM6AAAAACIH6X326VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNRYGM4TKMBQGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, this could cause some asan issues as the
vecs
andlens
objects were not deleted.This was noticed internally on our codebase.
This is identical to #62569, but I had to switch github accounts.