mercredi 6 mai 2015

MeasureCharacterRanges, Region and IDisposable

Graphics.MeasureCharacterRanges returns an array of Region. Region implements IDisposable. Is it my responsibility as a caller to dispose each of them?

Neither the documentation nor the samples mentions this, which leads me to suspect that it is not necessary, although I fail to see why I would get away with it. At the same time, some other GDI+ objects are very bad to dispose (SystemFont, SystemBrush, SystemPen, etc...)

(I'm about to use this on a heavy loaded web service, where I recently tracked down a memory leak because someone had failed to dispose a bitmap.)

Aucun commentaire:

Enregistrer un commentaire