This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane, pablogsal, vstinner
Date 2022-02-02.02:50:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
FWIW, it seems -O0 don't merge local variables in different path or lifetime.

For example, see _Py_abspath

    if (path[0] == '\0' || !wcscmp(path, L".")) {
       wchar_t cwd[MAXPATHLEN + 1];
    wchar_t cwd[MAXPATHLEN + 1];

wchar_t is 4bytes and MAXPATHLEN is 4096 on Linux. So each cwd is 16388bytes.
-Og allocates 32856 bytes for it and -Og allocates 16440 bytes for it.

I don't know what is the specific optimization flag in -Og do merge local variable, but I think -Og is very important for _PyEval_EvalFrameDefault() since it has many local variables in huge switch-case statements.
-Og allocates 312 bytes for it and -O0 allocates 8280 bytes for it.

By the way, clang 13 has `-fstack-usage` option like gcc, but clang 12 don't have it.
Since Ubuntu 20.04 have only clang 12, I use `-fstack-size-segment` and to get stack size.
Date User Action Args
2022-02-02 02:50:12methanesetrecipients: + methane, vstinner, pablogsal
2022-02-02 02:50:12methanesetmessageid: <>
2022-02-02 02:50:12methanelinkissue46600 messages
2022-02-02 02:50:12methanecreate