Message336754
| Author |
vstinner |
| Recipients |
ammar2, josh.r, larry, serhiy.storchaka, vstinner, xtreak |
| Date |
2019年02月27日.13:13:29 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1551273209.27.0.244442408332.issue36127@roundup.psfhosted.org> |
| In-reply-to |
| Content |
About the stack memory usage, in the past, I used a subfunction tagged with _Py_NO_INLINE to work on temporary stack but then drop it:
void function()
{
subfunction(); /* use temporary stack */
/* don't waste stack memory */
...
}
I'm not sure if such pattern could be used here for things like " PyObject *argsbuf[12];".
The problem is that argument parsing uses a lot of local variables allocated on the stack. In practice, it's more like:
void function(args)
{
int x;
parse_args(args, &x); /* use temporary stack */
/* don't waste stack memory */
...
}
I expect a long list of "&arg" where arg is a local variable of function(). Well, that's basically the design of the current PyArg_ParseTuple() function family :-)
PyArg_ParseTuple() does its stuff in private and uses more stack memory, but once PyArg_ParseTuple() returns, the memory on the stack is "released" just because we exited the function. |
|