Assertions allocate GC

Hi there,

The new Assertion library is pretty cool, but… the most useful assertions, AreEqual (and variantions of) allocate garbage. That basically means the system is useless. You could have assertions all over the place, thus allocating lots of garbage. It seems to be caused by sloppy programming from unity’s side.

More details here: http://fogbugz.unity3d.com/default.asp?694773_meshjocanpje1emo

Best regards,
Arthur

1 Like

Hi Arthur,

Thanks for pointing this out. It was indeed the params argument that was causing the extra memory alloc. It’s not used anymore so it should be removed.

I looked at GetEqualityComparer as well to see if it can be improved. The idea behind caching IEqualityComparer objects was motivated by extensibility we wanted to provide but in the end we decided to just ship a simpler implementation. Also, I wasn’t aware of the fact the default comparer are cached.

Thanks!
Tomek

Awesome, thanks! Happy to hear that, hope that can be fixed. Other than that the lib is looking pretty cool :slight_smile: