Re: upvalue memory leak.

  • From: Mike Pall <mike-1208@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 17 Aug 2012 21:44:21 +0200

Robert G. Jakabosky wrote:
> On Thursday 16, Mike Pall wrote:
> > There's no easy way to avoid that. But I don't think this issue
> > matters much for non-synthetic code, though.
> 
> Attached is a more valid use-case.  A closure is used to easily wrap a block 
> of code with pcall() to catch any errors from the block, which is what I had 
> done the first time I ran into this issue with the frag_tables.lua test-case.

IMHO that's still pretty synthetic.

The compiler decides to back down on closure specialization after
it detects a polymorphic prototype. Usually that happens way
before anything is compiled for the prototype. And immutable
upvalues are not constified if there's no specialization to the
closure. This avoids the issue for closure-heavy coding styles.

--Mike

Other related posts: