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 protected])
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to