Interesting speed benchmark

Michael P. Soulier msoulier at storm.ca
Fri Jun 8 23:25:41 EDT 2001


On Thu, 07 Jun 2001 03:29:47 GMT, Rainer Deyke <root at rainerdeyke.com> wrote:
> 
> Basically that you have to do manual resource management for non-memory
> resources.
> 
> The following function leaks a file handle under Jython but works correctly
> under CPython:
> 
> def print_file(fname):
>   file = open(fname)
>   print file.read()

    But it's not a permanent leak, no? It leaks temporarily, but then the
derefereced file objects should be deleted when the GC finally fires up. 

    Mike

-- 
Michael P. Soulier <msoulier at storm.ca> 
"With sufficient thrust, pigs fly just fine. However, this is not necessarily a
good idea. It is hard to be sure where they are going to land, and it could be
dangerous sitting under them as they fly overhead." -- RFC 1925



More information about the Python-list mailing list