0
我使用Visual leak detector狩獵我的程序內存泄漏和無法找到如何擺脫FT_Load_Char泄漏,也文件並沒有說明GlyphSlot的內存deallociation什麼..對FreeType2 FT_Load_Char內存泄漏
這裏是我的代碼snipplet其中w得到約350字節的泄漏。
// creating ascii symbol map
for (int i = 32; i < 128; i++) {
if (FT_Load_Char(face, i, FT_LOAD_RENDER)) { // leak comes from here
fprintf(stderr, "Loading character %c failed!\n", i);
continue;
}
glTexSubImage2D(GL_TEXTURE_2D, 0, ox, oy, g->bitmap.width, g->bitmap.rows,
GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap.buffer);
float ax = g->advance.x >> 6;
float ay = ay = g->advance.y >> 6;
float bw = g->bitmap.width;
float bh = g->bitmap.rows;
float bl = g->bitmap_left;
float bt = g->bitmap_top;
m_GlyphMap[i] = Glyph(ax,ay, bw, bh, bl, bt, ox, oy);
ox += g->bitmap.width + 1;
// there should be some sort of deallociation...
}
所以主要問題:是有一些功能取消分配,我很想念GlyphSlot?還是它在Freetype中的錯誤?