Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » [FIXED] - Memory leak on empty CtrlLib app on single PC
[FIXED] - Memory leak on empty CtrlLib app on single PC [message #25645] Fri, 05 March 2010 20:17 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1259
Registered: September 2007
Senior Contributor
I've got one of my Ubuntu Karmik 64 machine that gives a weird memory leak on an empty basic CtrlLib app.
The weird stuff is that another machine with same compiler doesn't show the error.
After a regression testing I found a patch that triggers the error, svn revision 2141, file Draw/Font.cpp :

void Font::InitStdFont()
{
	ONCELOCK {
		DrawLock __;
		List();
		AStdFont = Arial(12);
		String name;
		int    height = 0;
		GetStdFontSys(name, height);
		int q = FindFaceNameIndex(name);
		if(q <= 0)
			q = FindFaceNameIndex("Tahoma");
		if(q <= 0)
			q = FindFaceNameIndex("Microsoft Sans Serif");
		if(q <= 0)
			q = FindFaceNameIndex("MS Sans Serif");
		if(q > 0) {
			AStdFont = Font(q, max(height, 1));
#ifndef PLATFORM_WIN32
			SyncStdFont();
#endif
		}
#ifdef PLATFORM_WIN32
		SyncStdFont();
#endif
	}
}


Taking off the calls of FindFaceNameIndex() for the 3 named fonts makes the bug disappear :

void Font::InitStdFont()
{
	ONCELOCK {
		DrawLock __;
		List();
		AStdFont = Arial(12);
		String name;
		int    height = 0;
		GetStdFontSys(name, height);
		int q = FindFaceNameIndex(name);
		if(q > 0) {
			AStdFont = Font(q, max(height, 1));
#ifndef PLATFORM_WIN32
			SyncStdFont();
#endif
		}
#ifdef PLATFORM_WIN32
		SyncStdFont();
#endif
	}
}


I guess there's some problem in FindFaceNameIndex()....

Ciao

Max

edit : after a small check, the issue disappears also taking out the SyncStdFont() call. Maybe some un-released data from inside it ?

Max

edit #2 : I think it's a problem of unfreed FT_Face in FontFc cache system, but I could be wrong.

CommonFontInfo GetFontInfoSys(Font font)
{
	if(GetFontInfoSysXft)
		return (*GetFontInfoSysXft)(font);
	CommonFontInfo fi;
	String path;
	FT_Face face = FTFace(font, &path);
	if(face) {
		fi.ascent = face->size->metrics.ascender >> 6;


Taking out the FTFace call (and setting face to NULL) the problem disappears too. I don't know enough in deep the font caching of upp, so I'll stop here the analysis Smile

Max

[Updated on: Sat, 06 March 2010 20:10]

Report message to a moderator

Re: Memory leak on empty CtrlLib app on single PC [message #25646 is a reply to message #25645] Fri, 05 March 2010 22:52 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1259
Registered: September 2007
Senior Contributor
Fixed today 06/03/2010 by Mirek.

Ciao

Max

[Updated on: Sat, 06 March 2010 20:11]

Report message to a moderator

Previous Topic: Valgrind broken
Next Topic: [FIXED] - Crash on today compiled ide
Goto Forum:
  


Current Time: Wed Jul 24 04:12:59 CEST 2019

Total time taken to generate the page: 0.00834 seconds