Your comments do make sense. But the glitch lies in the code where it tries
to format a chunk of text with CTFrameSetter. I doubt it might have been
trapped into some infinite loop of  memory allocation in the implementation
of
CTFrameSetterCreateFrame, and that's the reason why it's allocating a memory
beyond boundary (but somehow 64-bit worked?).

Anyway, I will try to implement the code with Cocoa tonight, and see how it
works. Thanks.


D.K.



On Thu, Nov 12, 2009 at 9:45 AM, Aki Inoue <[email protected]> wrote:

> Yes, CoreText is our core layout technology, and the Text System is built
> upon it.
>
> The difference is that the Text System utilizes the framework as its layout
> engine and provides functionalities beyond.
>
> For example, efficiently working with large documents is one of the
> higher-level additions the Text System transparently provides.
>
> Aki
>
> On 2009/11/11, at 17:39, DairyKnight wrote:
>
>
> 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 protected]> 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 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