kensho-technologies / pyctcdecode

A fast and lightweight python-based CTC beam search decoder for speech recognition.
Apache License 2.0
421 stars 89 forks source link

Fix potential memory leak issue #111

Open limdongjin opened 1 year ago

limdongjin commented 1 year ago

The "BeamSearchDecoderCTC" code has potential memory leaks. Even though the decoder object was removed (by calling "__del__" function), memory deallocation may not be achieved neatly, and I have experienced this issue. To deallocate memory for the decoder, the "cleanup" function must be explicitly called. Instead, when the "__del__" function is called, it seems natural to have the "cleanup" function also called.