From: Eric Wong Date: Sun, 5 Apr 2020 07:53:47 +0000 (+0000) Subject: release large (non ref) scalars using `undef $sv' X-Git-Tag: v1.4.0~22 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=fec19e492eacb10f990091592f423542ab4249bd;hp=fec19e492eacb10f990091592f423542ab4249bd;p=public-inbox.git release large (non ref) scalars using `undef $sv' Using `undef EXPR' like a function call actually frees the heap memory associated with the scalar, whereas `$sv = undef' or `$sv = ""' will hold the buffer around until $sv goes out of scope. The `sv_set_undef' documentation in the perlapi(1) manpage explicitly states this: The perl equivalent is "$sv = undef;". Note that it doesn't free any string buffer, unlike "undef $sv". And I've confirmed by reading Dump() output from Devel::Peek. We'll also inline the old index_body sub in SearchIdx.pm to make the scope of the scalar more obvious. This change saves several hundred kB RSS on both -index and -httpd when hitting large emails with thousands of lines. ---