|go ahead... be a heretic|
Re: Inline::C's AoA is much bigger than Perl'sby tlm (Prior)
|on Mar 16, 2009 at 22:24 UTC||Need Help??|
Update:Actually the problems with the code below, I just discovered, are far more serious than a mere memory leak. It blows up if I try to accesses the elements in the table... I guess it's time for me to call it a day!
OK, I'm replying to myself here...
After I posted the original query, I tried a different tack. I streamlined the C function make_aoa_c, as follows:
This took care of the size problem for the most part, and greatly improved the speed (though it's still slower than Perl).
Unfortunately, the code has sprung a small memory leak that I can't identify! Changing the number of repetitions to 10, now the output for the C case looks like this:
With every iteration, the memory grows by at least 8kb.
I have tried adding sv_2mortal around various items in the code (e.g. AV *table=(AV *)sv_2mortal((SV *)newAV())), but I get errors like:
If anyone can spot the memory leak here, I'd much appreciate it!
the lowliest monk