Subject: | $ctx->bind(foo => sub { ... }) leaks |
It appears that bound function values are not released on Perl or JavaScript side when context is destroyed. On Perl side, if the sub closes over large amount of data, that data will remain referenced as well. Even a simple sub {} loses 4k of memory every hundred Context creations and destructions, or so. Test loop as follows:
for (1 .. 10000) {
my $v8 = JavaScript::V8::Context->new();
$v8->bind(foo => sub {});
print grep /VmRSS/, `cat /proc/$$/status`;
}