[pypy-issue] Issue #2698: Suspected memory leak with pysnmp==4.4.1 on PyPy 5.9 only (Python seems fine) (pypy/pypy)

Edward Beech issues-reply at bitbucket.org
Tue Nov 7 04:28:07 EST 2017


New issue 2698: Suspected memory leak with pysnmp==4.4.1 on PyPy 5.9 only (Python seems fine)
https://bitbucket.org/pypy/pypy/issues/2698/suspected-memory-leak-with-pysnmp-441-on

Edward Beech:

The code to reproduce is fairly simple- obviously you'll need PyPy 5.9 installed first as well as pysnmp==4.4.1.

```
#!python

from pysnmp.hlapi import SnmpEngine, UdpTransportTarget, ContextData, ObjectType, ObjectIdentity, getCmd, UsmUserData, usmHMACSHAAuthProtocol, usmAesCfb128Protocol

ITERATIONS = 65536

for i in range(0, ITERATIONS):
    snmp_engine = SnmpEngine()
    context_data = ContextData()

    errorIndication, errorStatus, errorIndex, varBinds = next(
        getCmd(
            snmp_engine,
            UsmUserData(
                userName='some_username',
                authKey='some_auth_key',
                privKey='some_priv_key,
                authProtocol=usmHMACSHAAuthProtocol,
                privProtocol=usmAesCfb128Protocol,
            ),
            UdpTransportTarget(
                ('some_host', 161),
                timeout=5,
                retries=2,
            ),
            context_data,
            ObjectType(ObjectIdentity('.1.3.6.1.2.1.1.5.0'))
        )
    )

    print '{0}/{1} - {2}'.format(i + 1, ITERATIONS, varBinds)

    del snmp_engine
    del context_data
```

Under PyPy 5.9 memory use steadily increases until (in my experience) MacOS crashes; in Python however, all seems fine.

I've also raised an issue on the [PySNMP Github page.](https://github.com/etingof/pysnmp/issues/103)




More information about the pypy-issue mailing list