Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8460569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:38:39+00:00 2026-06-10T13:38:39+00:00

I have a memory leak when working with a CGMutablePath under the following circumstances:

  • 0

I have a memory leak when working with a CGMutablePath under the following circumstances:

- (CGMutablePathRef) textMutablePathForFrame:(CGRect)frame
{
    CGAffineTransform transform = CGAffineTransformMakeScale(frame.size.width / self.shapeMutablePathSize.width, frame.size.height / self.shapeMutablePathSize.height);

    return CGPathCreateMutableCopyByTransformingPath(self.shapeMutablePath, &transform);
}

- (CTFrameRef) textFrameForFrame:(CGRect)frame framesetter:(CTFramesetterRef)framesetter
{
    CGMutablePathRef textMutablePath = [self textMutablePathForFrame:frame];
    CTFrameRef textFrame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), textMutablePath, NULL);
    CGPathRelease(textMutablePath);

    return textFrame;
}

Through instrument analysis I get a memory leak at the line with “return” in textMutablePathForFrame that says “Potential leak of an object allocated on line 132” (line 132 is the return line itself).

I also get a memory leak in textFrameForFrame at the line “CGPathRelease(textMutablePath);” that says: “Incorrect decrement of the reference count of an object that is not owned at this point by the caller”.

Can’t wrap my head around this, felt like I was finally getting a good understanding of memory management in Core.

UPDATE: Looking like this is possibly a bug, going to bump it one more time to see if anyone else feels differently.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:38:41+00:00Added an answer on June 10, 2026 at 1:38 pm

    @JonathanCichon is correct in principle, but has the wrong naming convention. The correct naming convention for the ObjC method is newMutablePathForFrame. The analyzer is correct. The “Create” rule only applies to Core Foundation. The ObjC naming conventions are in the Advanced Memory Management Programming Guide. The Core Foundation rules, which are slightly different and include the “Create” rule, are in the Memory Management Programming Guide for Core Foundation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have memory leak in the web application (servlet) that I am working on.
I have a memory leak in my iOS app which sometimes causes it to
I have a memory leak on one of the part of my node.js application.
I have a memory leak from 3 UIImages the problem is I can't just
I have a problem with a memory leak. I have this code in a
I have a problem with a memory leak in a very large ASP.NET application.
I have successfully debugged my own memory leak problems. However, I have noticed some
I have a static std::vector in a class. When I use Microsoft's memory leak
Our team is faced with slow but serious Javascript memory leak . We have
I have monitor my java application with profiler to know memory leak. And I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.