Release the global interpreter lock when running perl code
Fix memory leak