h5py/h5py — pull request #258 by andrewcollette (2013-01-15 02:01:05+00:00)
Title: Fix for memory leak (Issue 257)

Fixes memory leak reported by Luke Campbell (off-list) and documented in issue #257.

Evidently strings for major and minor error codes need to be explicitly freed in HDF5 1.8 (they didn't in 1.6). Luke's test script opens & closes a File object several thousand times. Code in the h5py._objects relied on catching a RuntimeError caused when a file was explicitly closed, leading to the leak.

This PR plugs the leak and also modifies _objects to avoid relying on exceptions in this case, which may be a slight performance enhancement.