Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge memory leak converting a file? #2

Open
ggrieco-tob opened this issue Dec 26, 2018 · 0 comments
Open

Huge memory leak converting a file? #2

ggrieco-tob opened this issue Dec 26, 2018 · 0 comments
Labels
question Further information is requested

Comments

@ggrieco-tob
Copy link

If you workaround issue #1 commenting the code that raises exceptions every time asciicast2gif finds unsupported escape characters using this patch:

diff --git a/asciicast2gif/asciicast.py b/asciicast2gif/asciicast.py
index 5a1b3be..1c49f7a 100644
--- a/asciicast2gif/asciicast.py
+++ b/asciicast2gif/asciicast.py
@@ -263,7 +263,7 @@ class ANSITerminal(Screen):
         elif char in '\030\031':
             self._state = ANSITerminal.TerminalState.OUTSIDE
         else:
-            raise Exception("Escape sequence ESC \\x%x is not currently supported!" % ord(char))
+            print("Escape sequence ESC \\x%x is not currently supported!" % ord(char))
 
     def _write_escbkt(self, char):
         esc_value = to_int(self._esc, 1)
@@ -308,13 +308,13 @@ class ANSITerminal(Screen):
                 # we don't need to handle bracketed paste mode
                 pass
             else:
-                raise Exception("ESC[%sh escape is currently unsupported!" % self._esc)
+                print("ESC[%sh escape is currently unsupported!" % self._esc)
         elif char == 'l':
             if self._esc == '?2004':
                 # we don't need to handle bracketed paste mode
                 pass
             else:
-                raise Exception("ESC[%sl escape is currently unsupported!" % self._esc)
+                print("ESC[%sl escape is currently unsupported!" % self._esc)
         elif char == 'm':
             self._write_esc_m()
         elif char == 's':
@@ -323,7 +323,7 @@ class ANSITerminal(Screen):
             if self._stored_pos is not None:
                 self.move_to(*self._stored_pos)
         elif char in 'STfinhl':
-            raise Exception("ESC[%s%s escape is currently unsupported!" % (self._esc, char))
+            print("ESC[%s%s escape is currently unsupported!" % (self._esc, char))
         else:
             matched = False
         if matched:

then converting this asciinema cast file will trigger very large memory allocations that will force you to kill the program (or you will have to restart your computer!)

@ggrieco-tob ggrieco-tob added the question Further information is requested label Dec 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant