fix: memory leaks when viewing or applying algorithm to multiple lines