aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff_int.h
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-10-04 10:12:27 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-10-04 10:12:27 +0000
commitf4174837da105cb47f793106fb8f2af2eacaf008 (patch)
tree3c4f9bc7beae2b87a7ab0ef2db668099b4d9c145 /roff_int.h
parent6e0d264ad268deb5d0616b3fef3dae6a2e7f5014 (diff)
downloadmandoc-f4174837da105cb47f793106fb8f2af2eacaf008.tar.gz
mandoc-f4174837da105cb47f793106fb8f2af2eacaf008.tar.zst
mandoc-f4174837da105cb47f793106fb8f2af2eacaf008.zip
Do not leak 64 bytes of heap memory every time a manual page calls
a user-defined macro. Calls of standard mdoc(7) and man(7) macros were unaffected, so the effect on OpenBSD manual pages was small, about 80 Kilobytes grand total for a full run of "makewhatis /usr/share/man". Argument expansion contexts for user-defined macros are stored on a stack that grows as needed if calls of user-defined macros are nested or recursive. Individual stack entries contain dynamically allocated arrays of pointers to arguments; these argument arrays also grow as needed if user-defined macros take more than eight arguments. The mistake was that argument arrays of already initialized expansion contexts were leaked rather than reused on subsequent macro calls. I found this issue in a systematic hunt for memory leaks after Michael <Stapelberg at Debian> reported memory exhaustion problems on the production server manpages.debian.org. This sub-Megabyte leak is not the cause of Michael's trouble, though, where Gigabytes of memory are being wasted. We are still investigating whether the original problem may be related to his supervisor process, which is written in Go, rather than to mandoc.
Diffstat (limited to 'roff_int.h')
0 files changed, 0 insertions, 0 deletions