From: daid Date: Mon, 12 Jan 2015 12:57:11 +0000 (+0100) Subject: Improve memory handling. X-Git-Tag: 15.01-RC8~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0faee70204e91827a1e8f5ba6c0a2b5d61e9bbb1;p=cura.git Improve memory handling. --- diff --git a/Cura/util/bigDataStorage.py b/Cura/util/bigDataStorage.py index d1c4c86b..b3894dac 100644 --- a/Cura/util/bigDataStorage.py +++ b/Cura/util/bigDataStorage.py @@ -13,7 +13,7 @@ class BigDataStorage(object): def write(self, data): self._active.write(data) - if self._active.tell() > 1024 * 1024 * 100: + if self._active.tell() > 1024 * 1024 * 50: self._active = StringIO.StringIO() self._list.append(self._active) @@ -39,11 +39,11 @@ class BigDataStorage(object): data = self._list[0].getvalue() block0 = data[0:2048] block1 = StringIO.StringIO() + self._list[0] = StringIO.StringIO() block1.write(data[2048:]) self._list.insert(1, block1) for key, value in dictionary.items(): block0 = block0.replace(key, str(value)) - self._list[0] = StringIO.StringIO() self._list[0].write(block0) def __len__(self): diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index cf2d16f7..f4e521e2 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -298,7 +298,10 @@ class Engine(object): def _runEngine(self, scene, overrides, old_thread): if old_thread is not None: if self._process is not None: - self._process.terminate() + try: + self._process.terminate() + except: + pass old_thread.join() self._callback(-1.0) @@ -427,6 +430,7 @@ class Engine(object): self._callback(-1.0) self._process = None except MemoryError: + traceback.print_exc() self._result.addLog("MemoryError") self._callback(-1.0)