Imported changes from CPAN v1.0
Added tests for memory cycles
Fixed memory cycles