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
_tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc() #66532
Comments
The PyMem_Malloc(size) function has a well defined behaviour: if size is 0, a pointer different than NULL is returned. It looks like ckalloc(size) returns NULL if the size is NULL: see issue bpo-21951 (bug on AIX). Moreover, memory allocated by ckalloc() is not traced by the new tracemalloc module! Attached patch replaces calls to ckalloc() and ckfree() with PyMem_Malloc() and PyMem_Free(). It may fix the issue bpo-21951 on AIX. There is still a call to ckfree() in Tkapp_SplitList(). This memory block is allocated internally by Tcl, not directly by _tkinter.c. |
FREECAST can be dropped here, PyMem_Free() always takes a void* pointer. |
Event structs (Tkapp_CallEvent, VarEvent, CommandEvent) must have been allocated by the caller using Tcl_Alloc or ckalloc (see man Tcl_ThreadQueueEvent). |
Here is updated patch which is synchronized with the tip after changes made in bpo-21951 and addresses my comments. |
I read tkinter_pymem_2.patch. Remaining calls to ckalloc():
Remaining calls to ckfree():
|
Oh, you are right, thanks.
Perhaps you forgot to press the "Publish" button. |
tkinter_pymem_3.patch looks good to me. |
And to me too. Please commit it, this is mainly your patch. |
New changeset 9f1d3e6e6ce6 by Victor Stinner in branch 'default': |
Ok, thanks, done. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: