Re: [PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-01 Thread Koichi Murase
To add some contexts not in the commit message, I knew that recent versions of Bash consume more memory when the same shell script is loaded. After bisecting, I realized that the increase in memory use was actually caused by a single commit ba4ab055 (see the attached image. The vertical axis is t

[PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-01 Thread Koichi Murase
The function `bind_function_def' (variables.c) stores the function metadata in the hash map `shell_function_defs' in variables.c. The saved information is used by BASH_SOURCE (execute_cmd.c) and the output of `declare -F func' with `shopt -s extdebug' (builtin/declare.def) through the interface `f