Hi,

I just found a neat trick to free up an emergency stash of memory in a funtion 
that overrides sys.excepthook. The rationale is that all exceptions, including 
MemoryErrors will be logged.
The code is below. My question: is that memory *guaranteed* to be freed right 
after the 'del' statement? Or should one call gc.collect to be really sure?

rainydayfund = [[] for x in xrange(16*1024)] # or however much you need
def handle_exception(e):
global rainydayfund
del rainydayfund
... etc, etc ...
http://stackoverflow.com/questions/1235349/python-how-can-i-handle-any-unhandled-exception-in-an-alternative-way

Thanks!

Albert-Jan
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to