[C#] For android platform, how much garbage is too much?

For android platform, how much of active garbage is too much?

Just need reference numbers.

1 Like

Not sure there is a quantifiable amount, however I would say if its constant, its too much.

If I understand correctly, the slowdown comes from the GC collection. Im not sure if there’s a limit/point at which GC decides to collect. Ive never looked into. I just try and avoid giving it food.

2 Likes

I have a test app on a 3 or 4 year old android device. The app has 1 megabyte of garbage allocation active. I’d like to know if that’s something I should really be concerned about or not.

Basically, unity docs on gc talk about 200kb of active garbage. On the other hand, language is obviously built around idea of “not caring about memory allocations” and there’s large number of sources that will generate more garbage, at the same time the language doesn’t have “delete” keyword.

Basiaclly, “reference types are good, garbage is bad, strings are immutable and you shall not have delete keyword!”. That’s… not very reasonable, I think.

1 Like

I would say if its 1Mb once thats fine.

if its 1Mb every couple of seconds, its gonna give you a bad day.

Hmm. :-\ Reasonable.

I guess I’ll concentrate on other sources of high memory usage first.

I would just look to curb any allocations that are occurring on a frame to frame basis.

you are always going to have allocations, its just how often the allocations occur and when they go out of scope that matter

I try keep it under a kb with occasional spikes of 2 or 3kb

2 Likes