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

Joshua Tauberer tauberer at for.net
Thu Jan 12 21:21:56 EST 2006


Gonzalo Paniagua Javier wrote:
>> 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().

Okay, ok. :)  But there are a bunch of callers and they're called in a 
bunch of places...

>> 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!).

Yeah, that was easy enough to fix with:
String.Compare(name, fields[i].ColumnName, true,
System.Globalization.CultureInfo.InvariantCulture);

Atsushi Eno wrote:
 > is that ByteEncoding related allocation a problem in ByteEncoding
 > or in whatever calls ByteEncoding.GetString() ?

It's not a problem within ByteEncoding ("afaics" ... as far as I can see?).

I think I should be looking for objects that aren't being released by 
whatever had a reference to them, so that they're not being GC'ed and 
are building up.  So cutting down on raw allocations can't hurt, but 
unless the act of allocating can cause the heap to grow and grow, I 
think I'm looking at the wrong thing.  Well, I'm not going to have much 
time to work on this for a few weeks, so I guess in the meanwhile I'll 
think up a new strategy to figure this out.

Can we get a way for a profiler to see when objects are being 
deallocated, or to see total counts of objects by type?  (Is that what 
heap buddy did (for anyone reading this far), or did it just see 
allocations?)

-- 
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **





More information about the Mono-list mailing list