pygraphviz/pygraphviz — pull request #7 by hagberg (2013-10-07 19:03:04+00:00)
Title: Memory leak fixes for file handling.

The read() method has a memory leak. There are two issues to address.

1) Added explicit agclose() to obsolete file handle in AGraph.read() method
2) User must explicitly call AGraph.close() or else use a a context manager (now enabled)

To process many files without a leak you can do one of the following:

```python
import pygraphviz
for i in range(1000000):
A = pygraphviz.AGraph()
A.read('foo.dot')
A.close()
```

```python
import pygraphviz
for i in range(1000000):
with pygraphviz.AGraph() as A:
A.read('foo.dot')
```