]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
Free some collection types before testing Suricata
authorJason Ish <ish@unx.ca>
Mon, 11 Feb 2019 15:36:42 +0000 (09:36 -0600)
committerJason Ish <ish@unx.ca>
Wed, 13 Feb 2019 14:53:08 +0000 (08:53 -0600)
Forces Python to free up some memory before starting Suricata
which may use a lot of memory itself.

Fixup for low memory devices.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2791

suricata/update/main.py

index 3a672087f6712e6539390d8c3ebab46489909a3b..66fe21dcb3ec4c4e0960bdce2520f89310585a10 100644 (file)
@@ -1425,6 +1425,14 @@ def _main():
         notes.dump_notes()
         return 0
 
+    # Set these containers to None to fee the memory before testing Suricata which
+    # may consume a lot of memory by itself. Ideally we should refactor this large
+    # function into multiple methods so these go out of scope and get removed
+    # automatically.
+    rulemap = None
+    rules = None
+    files = None
+
     if not test_suricata(suricata_path):
         logger.error("Suricata test failed, aborting.")
         logger.error("Restoring previous rules.")