Results 1 to 2 of 2

Thread: Python seems to leak communicator objects

  1. #1
    joshmoore is offline Registered User
    Name: Josh Moore
    Organization: Glencoe Software, Inc.
    Project: OMERO, http://trac.openmicroscopy.org.uk/omero
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    115

    Python seems to leak communicator objects

    With 3.3.1, the following code:
    Code:
    import Ice
    import gc
    
    ic = Ice.initialize()
    ic.shutdown()
    ic.destroy()
    del ic
    reload(Ice)
    gc.collect()
    
    print "GLOBAL"
    print dir()
    
    print "LEFTOVER"
    for o in gc.get_objects():
        if str(type(o)).find("Ice") > -1:
            print type(o)
    prints:

    Code:
    GLOBAL
    ['Ice', '__builtins__', '__doc__', '__file__', '__name__', 'gc']
    LEFTOVER
    <class 'Ice.OperationMode'>
    <class 'Ice.OperationMode'>
    <class 'Ice.OperationMode'>
    <class 'Ice.EndpointSelectionType'>
    <class 'Ice.EndpointSelectionType'>
    <class 'Ice.CommunicatorI'>
    Code:
    for x in range(100):
        ic = Ice.initialize()
        ic.shutdown()
        ic.destroy()
        del ic
    gc.collect()
    leaves 100 communicators, but only the 3 operation modes and the 2 endpoint selection types.

    However, if I add "del ic._impl" then garbage collection can reap the communicator:
    Code:
    import Ice
    import gc
    
    for x in range(100):
        ic = Ice.initialize()
        ic.shutdown()
        ic.destroy()
        del ic._impl # THIS LINE ADDED
        del ic
    gc.collect()
    
    print "GLOBAL"
    print dir()
    
    print "LEFTOVER"
    for o in gc.get_objects():
        if str(type(o)).find("Ice") > -1:
            print type(o)
    prints:

    Code:
    <class 'Ice.OperationMode'>
    <class 'Ice.OperationMode'>
    <class 'Ice.OperationMode'>
    <class 'Ice.EndpointSelectionType'>
    <class 'Ice.EndpointSelectionType'>
    Cheers,
    ~josh

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Josh,

    Thanks for reporting this.

    Regards,
    Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 08-03-2009, 05:29 AM
  2. Replies: 0
    Last Post: 03-12-2009, 10:31 AM
  3. Replies: 1
    Last Post: 04-13-2007, 09:49 PM
  4. python: shutdown of communicator hangs
    By hiasl in forum Help Center
    Replies: 6
    Last Post: 02-05-2007, 01:50 PM
  5. Creating Proxies for "Ice objects" with Python
    By hiasl in forum Help Center
    Replies: 5
    Last Post: 09-13-2005, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •