[Python-bugs-list] [ python-Bugs-474538 ] Memory (reference) leak in poller.regis

noreply@sourceforge.net noreply@sourceforge.net
Thu, 25 Oct 2001 13:19:11 -0700


Bugs item #474538, was opened at 2001-10-24 10:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=474538&group_id=5470

Category: Extension Modules
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Dave Brueck (dbrueck)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Memory (reference) leak in poller.regis

Initial Comment:
A reference leak occurs if you call the register (and possibly unregister) functions of poller objects (obtained by calling select.poll). The problem does not manifest itself on file descriptors with a value <= 100, so it may be that register() is leaking references to integer objects and those less than 101 are simply leaked references to cached integer objects.

I'm running Python 2.1.1 on Linux Mandrake 8.1 and Linux 2.1b1 on RedHat 7.0.

This code reproduces the problem:

import select
poller = select.poll()
while 1:
  poller.register(101, 1)

(now go peek at the memory usage for this process - it skyrockets)

If you replace 101 above with 100 or less, the memory usage remains flat. I found this problem because my program routinely has to handle more than 100 socket connections.

I believe the reference to the flag parameter is also being leaked, but you don't usually see the problem because flag values are small and are therefore references to cached integers.

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-25 13:19

Message:
Logged In: YES 
user_id=6380

Thanks! Fixed in CVS, will be in 2.2b2.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=474538&group_id=5470