Ensembl / Bio-DB-HTS

Git repo for Bio::DB::HTS module on CPAN, providing Perl links into HTSlib
Apache License 2.0
24 stars 16 forks source link

Add DESTROY methods for guaranteed resources dealloction #50

Closed Zhicheng-Liu closed 7 years ago

Zhicheng-Liu commented 7 years ago

These methods will be called when their corresponding objects are garbage collected. Adding these where needed to deallocate underlying C objects and/or release resources.

Also remove "close" methods where possible to avoid these being called where the objects may be referenced by multiple references and the references may become dangling.

Also add Bio::DB::HTS::VCF::HeaderPtr and Bio::DB::HTS::VCF::RowPtr packages to refer to a pointer object returned from C where it is just a pointer to the underlying C object but does not own it (like in vcf_sweep). Use the already existed Bio::DB::HTS::VCF::Header and Bio::DB::HTS::VCF::Row for the objects that the pointers actually own and are responsible for deallocation if needed.

Minor changes to test cases to accommodate the above changes.