Message336754
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. |
|
Date |
User |
Action |
Args |
2019-02-27 13:13:29 | vstinner | set | recipients:
+ vstinner, larry, serhiy.storchaka, josh.r, ammar2, xtreak |
2019-02-27 13:13:29 | vstinner | set | messageid: <1551273209.27.0.244442408332.issue36127@roundup.psfhosted.org> |
2019-02-27 13:13:29 | vstinner | link | issue36127 messages |
2019-02-27 13:13:29 | vstinner | create | |
|