[ pyobjc-Bugs-3313601 ] NSBezierPath memory leak

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
Bugs item #3313601, was opened at 2011-06-08 20:14
Message generated for change (Tracker Item Submitted) made by gcewing
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=114534&aid=3313601&group_id=14534

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Gregory Ewing (gcewing)
Assigned to: Nobody/Anonymous (nobody)
Summary: NSBezierPath memory leak

Initial Comment:
NZBezierPath.appendBezierPathWithPoints_count_ appears to leak memory
under some circumstances depending on the type of object passed in.

Observed using MacOSX 10.6.4, Python 2.7, PyObjC 2.3

Here are two test cases, one of which leaks and the other doesn't.

#  Case 1 - Passing a list of tuples
#  This one leaks

from AppKit import NSBezierPath, NSAutoreleasePool

def test():
    path = NSBezierPath.bezierPath()
    while 1:
        pool = NSAutoreleasePool.alloc().init()
        points = [(x, x) for x in xrange(10)]
        path.appendBezierPathWithPoints_count_(points, len(points))
        path.removeAllPoints()
        pool = None

test()

#  Case 2 - Passing an array.array of type 'f'
#  This one does NOT leak, apparently because it is able to pass the
#  contents of the array directly to ObjC without any conversion.

#  Does not leak

from AppKit import NSBezierPath
import array

def test():
    path = NSBezierPath.bezierPath()
    while 1:
        ar_points = array.array('f', xrange(2000))
        p = ar_points
        n = len(p) // 2
        path.appendBezierPathWithPoints_count_(p, n)
        path.removeAllPoints()

test()


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=114534&aid=3313601&group_id=14534

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.