Hi Werner Thanks alot for the reply. I have looked at your suggestion and tried to understand how it works. I have one question regarding this. I understand that after we set env variable FT2_ALLOC_COUNT_MAX and FT2_DEBUG_MEMORY on runtime, the value for FT2_ALLOC_COUNT_MAX will be assigned to table->alloc_total_max inside ft_mem_debug_init() (in ftdbgmem.c). This value will later on be used to bound the memory allocation. However I am confused that inside function ft_mem_debug_alloc() there is the following check:
if ( table->bound_total && table->alloc_total_max - table->alloc_current > (FT_ULong)size ) return NULL; Does the above check aim to bound memory allocation to up to table->alloc_total_max? If that is the case, should the check be the following instead: if ( table->bound_total && table->alloc_total_max - table->alloc_current < (FT_ULong)size ) return NULL; Please let me know if I understand wrongly. best regards Maggy Anastasia Suryanto On Sat, Mar 13, 2010 at 8:06 PM, Werner LEMBERG <w...@gnu.org> wrote: > > > (1) static array: currently we know that all memory consumption by > > freetype is done through malloc calls and its variants. However, is > > there any other memory used in freetype, such as global arrays, > > which are used for memory allocation? If so, do they need any kind > > of configuration? > > Yes, there are static arrays, see for example src/psnames/pstables.h. > However, they can be put into read-only memory since all of them are > tagged with the `const' modifier. > > > (2) Is there a way for determining the upper bound of memory usage > > for freetype when cache is being used. I know that we can set the > > upper bound for cache nodes (glyph image, cmap, sbitchace, etc.), > > but is there a way to determine the memory consumption for FT_FACE > > and FT_SIZE? From what I have seen regarding this, we can only > > limit the number of FT_FACE and FT_SIZE; however, how to determine > > the memory requirements for a given number of allowable FT_FACE and > > FT_SIZE. I am using freetype for an embedded system at the moment, > > thus, memory is really a constraint, and it's very important for me > > to be able to determine the size of the heap. > > I suggest that you use the FreeType memory debugger (see the > FT_DEBUG_MEMORY option in docs/DEBUG). For debugging, the heap size > can be limited with the FT2_ALLOC_TOTAL_MAX environment variable. Its > results can be then used for your own memory allocation routines. > > > Werner >
_______________________________________________ Freetype-devel mailing list Freetype-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype-devel