[Mono-list] Profiling web app to find where memory is going

Gonzalo Paniagua Javier gonzalo at ximian.com
Tue Jan 10 19:15:44 EST 2006


On Sun, 2006-01-08 at 20:49 -0500, Joshua Tauberer wrote:

> I can see now that a single page load is resulting in the creation of 
> 100,000 new string instances.  Seems like a lot, but maybe it's just par 
> for the course.  So now I have a new problem: I can see tons of strings 
> are being allocated by I18N.Common.ByteEncoding:GetString() and 

You have to figure out who is calling GetString(). Don't you have the
stack trace that points to the right place to optimize? If you don't,
just print 1 stacktrace out of every 100 calls to GetString and you'll
see who is calling ByteEncoding.GetString.

> MySql.Data.MySqlClient.MySqlDataReader:GetOrdinal(), but I don't know if 
[...]

GetOrdinal() is pretty heavy creating string instances and most of them
can be avoided (name.ToUpper() and fieldName[i].ToUpper() called on
every iteration!).

-Gonzalo




More information about the Mono-list mailing list