freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ft-devel] Re: Problem with FreeType cache system


From: Turner, David
Subject: RE: [ft-devel] Re: Problem with FreeType cache system
Date: Tue, 20 Sep 2005 09:48:51 +0200

Hello,

> 
> [...]  I'm having problem with the cache system under low memory
> conditions.  It seems if our system doesn't have 'max_bytes'
> available, FTC_CMapCache_Lookup will repeatedly fail (returing
> glyph_index = 0) once there is no more memory.  Should the system free
> part of the cache when there is no more memory or do I need to do this
> manually (aka. freeing some FACEs/GLYPHs)?
>  
> Any help would be greatly appreciated.
> 

you should never free the FT_Face and FT_Size objects that were
allocated through the cache, i.e. those retrieved by 
FTC_Manager_LookupFace and FTC_Manager_LookupSize.

All other FT_Face and FT_Size objects created directly (e.g. with
FT_New_Face) are your own responsability.

"max_bytes" corresponds to the maximum amount of memory you want
to dedicate to the cache nodes, it doesn't need to correspond to
the total memory available on your system; it's used to prevent
the cache from inflating to vexing levels.

note that it does NOT account for managed FT_Face and FT_Size 
objects though.

when you perform a lookup, out-of-memory errors are detected _within_
the lookup, and force incremental flushes of the cache until enough
memory is released for the lookup to succeed.

If a lookup fails with FT_Err_Out_Of_Memory, this means that your
cache has already been completely flushed, and still no memory was
available for the operation.

Note that there was a bug, fixed in 2.1.9 which prevented the incremental
cache flushing to work properly, and this caused improper lookup failures;
however, that was only in the SBit cache, not the CMap one.

Have you tried initializing the cache manager with only _one_ maximum
managed FT_Face when creating your FTC_Manager, this can help reduce
the heap requirements, at the price of slower performance.

Another option is to enable to memory-saving optimizations that are
available in 2.1.10. They're not enabled by default because this breaks
some third-party libraries that use FT2 *internals* (grrrrrr..) that
change a lot when this option is used.

To enable it, #define FT_OPTIMIZE_MEMORY at the end of your ftoption.h
configuration file. This can significantly reduce the memory needed by
each FT_Face and FT_Size objects, especially when using memory-mapped
files.


Apart from that, which version of FreeType are you using ?

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)


> 
>  
> Chip Kerchner
> Senior Software Engineer
> Pixelworks, Inc.
> 503.454.0267
> address@hidden
> username: chipkerchner
> projectname: freetype
> 
> 
> _______________________________________________
> Freetype-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/freetype-devel
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]