Re: Weird problem with Core Text
Re: Weird problem with Core Text
- Subject: Re: Weird problem with Core Text
- From: DairyKnight <email@hidden>
- Date: Thu, 12 Nov 2009 09:39:03 +0800
But as I understand, Cocoa Test System, the NSLayoutManager and its
supplementary classes are built upon Core Text. So if Core Text doesn't
work, there's no reason cocoa test would succeedl, right?
DairyKnight
On Thu, Nov 12, 2009 at 2:20 AM, Aki Inoue <email@hidden> wrote:
> Hi,
>
> CoreText is designed to be a core line layout engine, a building block for
> full-fledged text systems like the Cocoa Text System or WebKit.
>
> So, it's not meant for this kind of full document processing.
>
> It's hitting the 4GB memory barrier. I can reproduce the same issue on SL
> running in 32bit.
>
> I suggest considering to use the Text System instead.
>
> Aki
>
> On 2009/11/11, at 7:39, DairyKnight wrote:
>
> > 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
>
>
_______________________________________________
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