diff --git a/ocl.py b/ocl.py index 4f9a6f05..093f649d 100644 --- a/ocl.py +++ b/ocl.py @@ -535,7 +535,11 @@ def union(s,t) : def unionSequence(s,t) : res = [] res.extend(s) - res.extend(t) + + # Add all elements of t that are not in s (Prevents duplicates) + new_res = [x for x in t if x not in s] + res.extend(new_res) + return res diff --git a/oclfile.py b/oclfile.py index 7f7795d1..dfd83e81 100644 --- a/oclfile.py +++ b/oclfile.py @@ -4,6 +4,8 @@ import pickle import socket import tempfile +import gc + from enum import Enum @@ -11,6 +13,15 @@ def free(x): del x + # Garbage Collection + try: + gc.collect() + except Exception as e: + pass + else: + pass + + class OclFile: oclfile_instances = []