• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Weird problem with Core Text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird problem with Core Text


  • Subject: Weird problem with Core Text
  • From: DairyKnight <email@hidden>
  • Date: Wed, 11 Nov 2009 23:39:32 +0800

Hi all,

I'm working with a program utilizing Core Text, but occurred to some strange
problems. When trying to reformat a document
larger than 1MB, the program crashes with the following error msg:
malloc: *** mmap(size=4,294,598,656) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

Code is attached below. To me, it doesn't seem to have any problems. The app
crashes at the line creating the CTFrameRef, and
what's even stranger is, it crashes at around 1/3 of the file, so not
necessarily to be an out-of-memory problem. - It says CTFrameRef is
allocating 4GB of memory, which runs beyond the 32-bit boundary.

PS: The app runs without any problems on Snow Leopard, so could possibly be
a bug with Leopard?

   //
   // text is some Attribute String previously created
   //
    CTFramesetterRef framesetter =
CTFramesetterCreateWithAttributedString((CFAttributedStringRef) text);
    frameRange = CFRangeMake(0, 0);
    for (range = CFRangeMake(0, 0); range.location < text.length;
range.location += frameRange.length)
    {

        CGMutablePathRef path = CGPathCreateMutable();
        CGPathAddRect(path, NULL, frameRect);

        CTFrameRef frame = CTFramesetterCreateFrame(framesetter, range,
path, NULL);

        frameRange = CTFrameGetVisibleStringRange(frame);

        CFArrayRef lines = CTFrameGetLines(frame);

        CFIndex i, total = CFArrayGetCount(lines);
        CGFloat y = frameRect.origin.y;

        frameRect.origin.y = y;
        frameRect.size.height = contentSize.height;

        CFRelease(path);
        CFRelease(frame);
    }
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Weird problem with Core Text
      • From: Aki Inoue <email@hidden>
  • Prev by Date: Re: [iPhone] Implement a screen like contacts screen
  • Next by Date: Re: Implicit @try/@catch?
  • Previous by thread: Re: boundingRectWithSize:Option: and height constraint
  • Next by thread: Re: Weird problem with Core Text
  • Index(es):
    • Date
    • Thread