私はちょうど次のエラーがあり、私はそれをどうしたらいいのか分かりません。誰かが私にこのエラーを説明できますか?
Unhandled exception in thread started by <bound method Timer.__bootstrap of <Timer(Thread-3, stopped -1234564240)>>
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 525, in __bootstrap
self.__bootstrap_inner()
File "/usr/lib/python2.7/threading.py", line 565, in __bootstrap_inner
(self.name, _format_exc()))
File "/usr/lib/python2.7/traceback.py", line 241, in format_exc
return ''.join(format_exception(etype, value, tb, limit))
File "/usr/lib/python2.7/traceback.py", line 141, in format_exception
list = list + format_tb(tb, limit)
File "/usr/lib/python2.7/traceback.py", line 76, in format_tb
return format_list(extract_tb(tb, limit))
File "/usr/lib/python2.7/traceback.py", line 101, in extract_tb
line = linecache.getline(filename, lineno, f.f_globals)
File "/usr/lib/python2.7/linecache.py", line 14, in getline
lines = getlines(filename, module_globals)
File "/usr/lib/python2.7/linecache.py", line 40, in getlines
return updatecache(filename, module_globals)
File "/usr/lib/python2.7/linecache.py", line 133, in updatecache
lines = fp.readlines()
MemoryError
関連するコード(私はそれが実際に該当するかどうか分からないが、 - それは例外で言及した任意の方法である私のコードのほんの一部のみです):
class Timer(threading.Thread):
def __init__(self, interval, callback, limit=0, args=[], kwargs={}):
threading.Thread.__init__(self)
self.interval = interval/1000.0
self.callback = callback
self.limit = limit
self.args = args
self.kwargs = kwargs
self.iterations = 0
self._stop = threading.Event()
def restart(self):
self.iterations = 0
self._stop.clear()
threading.Thread.__init__(self)
self.start()
def run(self):
while not self._stop.wait(self.interval):
self.callback(*self.args, **self.kwargs)
self.iterations += 1
if self.limit > 0 and self.iterations >= self.limit:
break
def stop(self):
self._stop.set()
def stopped(self):
return self._stop.isSet()
私はそれを考えます私がこのコードを実行していたサーバが一種の崩れていたのはこの頃のことでした。これは単なる症状だったのでしょうか、それとも私のコードのどこかに問題があることを示していましたか? ほとんどの場合、私はちょうどこの地獄が何を意味しているか知りたいだけです。残りの部分はわかります。あなたがメモリ不足Python Docs ...
exception MemoryError
Raised when an operation runs out of memory but the situation may still be rescued
(by deleting some objects). The associated value is a string indicating what kind
of (internal) operation ran out of memory. Note that because of the underlying
memory management architecture (C’s malloc() function), the interpreter may not
always be able to completely recover from this situation; it nevertheless raises
an exception so that a stack traceback can be printed, in case a run-away program
was the cause.
私のPythonはそれについて知らないことが面白いです - それは2,5 GBで救済されました。私は限界が3 GiBだったと思ったが、どういうわけかここで早く来た。 – glglgl
@glglgl:私はどこかで私のステートメントに "win32"がないかもしれない。私はすべてのOSのプロセスごとのメモリ制限についてはっきりしていません - 私は制限があることを知っています。 ;) –