[Tutor] Question about the memory manager
Alan Gauld
alan.gauld at btinternet.com
Mon Jan 11 07:15:39 EST 2016
On 10/01/16 16:16, Steven D'Aprano wrote:
>> rainydayfund = [[] for x in xrange(16*1024)] # or however much you need
>> def handle_exception(e):
>> global rainydayfund
>> del rainydayfund
>> ... etc, etc ...
>
> I was going to write a scornful email about how useless this would be.
Me too.
> still think it's useless, but I see that the idea comes from Alex
> Martelli, who normally knows what he is talking about, so that makes me
> pause and think and perhaps do some experiments before commenting.
Me too. :-)
But I think that it definitely is heavily OS dependent.
It should work in most *nix environments the first time
you call the function. But on second call I'd expect
all bets to be off. And in most real-time OS's memory
goes right back to the OS pool - but even there it
would probably be available I guess, at least the first
time.
Maybe the theory is that if you get a memory error the
only sensible thing is just to log it and exit. In which
case you only ever call this once.
Steven, Did you try any experiments? I'm struggling
to come up with a reliable test scenario.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list