raspell icon indicating copy to clipboard operation
raspell copied to clipboard

memory leak in aspell_list_misspelled and aspell_correct_lines

Open drbrain opened this issue 13 years ago • 1 comments

raspell contains memory leaks in list_misspelled and correct_lines due to not using rb_ensure to call delete_aspell_document_checker and free the checker. In list_misspelled, if an exception is railed from rb_yield or rb_funcall then delete_aspell_document_checker will not be called. The same is true in aspell_correct_lines.

Here is an example illustrating the leak using list_misspelled:

require 'raspell'

checker = Aspell.new 'en_US'
1_000_000.times do
  begin
    checker.list_misspelled %w[wraung] do
      raise
    end
  rescue
  end
end

drbrain avatar Apr 05 '12 22:04 drbrain

I don't personally use Raspell anymore so mostly I curate pull requests...patches welcome!

evan avatar Apr 12 '12 07:04 evan