[Openmcl-devel] Sudden increment in executable image size.

Kaz Kylheku kaz at kylheku.com
Sun Nov 2 17:48:18 PST 2014


On 17.11.2010 22:14, Kaz Kylheku wrote:
          ^^^^
          (!)

> On Wed, 17 Nov 2010 22:01:21 -0800, Kaz Kylheku <kaz at kylheku.com>
> wrote:
> 
>> It turns out that the heap size suddenly jumps after the very last 
>> file is loaded.
> 
> I have isolated it to the use of a particular macro (mine, not CCL's)
> in that file.

Hi everyone.

I have revisited this four-year-old issue. I fetched a new CCL, on a new 
machine, built the program, and the problem still reproduced.

What's going on is that a particular macro is used in several places 
(not very many) and that macro generates some local functions which call 
the CL-PPCRE API function regex-replace-all. (Not at macro-expansion 
time: the calls to the function are just macro-generated code!)

The regular expressions involved are tiny and trivial; nothing that 
would explode a DFA state space.

Yet, the way this function is compiled somehow results in tremendous 
bloat. Each instance of the function call adds bloat. The macro 
generates two calls to the function; if I change the macro so it only 
generates one call to that function, the bloat delta cuts in half.

So I went into the "cl-ppcre/api.lisp" source file and put, above the 
regex-replace-all defun:

   (declaim (notinline regex-replace-all))

Bingo. This makes the problem go away. Instead of a nearly 70 megabyte 
executable, I get a 25 megabyte executable, which is about expected 
size.

Cheers!



More information about the Openmcl-devel mailing list