2009/3/7 Jun.Wang
<address@hidden>
I did the memory debug with a little modify.
1. In FT_Done_FreeType( FT_Library library ), I disabled the line:
FT_Done_Library( library ), so the memory report will disaply the current
memory.
???
2. I call FT_Done_FreeType() before FT_Done_Face(),
This is a bug in your program. After FT_Done_FreeType() is called, every memory allocated
by the corresponding FT_Library should be released (with the exception of FT_Glyph objects
allocated by the user, but you are responsible for free-ing them before FT_Done_FreeType())
Calling FT_Done_Face() after that is probably asking for a lot of trouble (i.e. waling dangling pointers
in the heap).
and I getted the
follws report:
//only load 1 character
FreeType Memory Dump: current=776564 max=776795 total=781508
count=59
//load 35 diff characters
FreeType Memory Dump: current=777225 max=777579 total=783118
count=59
//load 150K characters, there are some same characters
FreeType Memory Dump: current=779033 max=780079 total=34608360
count=60
after the FT_Done_Face(g_FTFace), the current for above all are
same:
FreeType Memory Dump: current=42697 max=777579 total=783118 count=21
It Looks while don't do FT_Done_Face(), the memory will increase
with the loaded numbers
3. I do the load as follows:
for(i = 0; i < Size; i++){
FT_Load_Glyph(g_FTFace, currChar[i], FT_LOAD_RENDER);
bitmap = &(g_FTFace->glyph->bitmap);
uiPixMode = g_FTFace->glyph->bitmap.pixel_mode;
bitmap_top = g_FTFace->glyph->bitmap_top;
bitmap_left = g_FTFace->glyph->bitmap_left;
bitmap_rows = bitmap->rows;
darw(bitmap);
}
Is there function to free memory after every FT_Load_Glyph? If do
FT_Done_Face() every time, then I need FT_New_Face every time also.
My freetype2 lib is 2.2.1.
Thanks for your reply.
--
View this message in context: http://www.nabble.com/Why-my-memory-is-not-been-freed--tp22383746p22383746.html
Sent from the Freetype - Dev mailing list archive at Nabble.com.
_______________________________________________
Freetype-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype-devel