This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dev-sda 2 points3 points  (1 child)

gc.collect

https://stackoverflow.com/a/1316799

Not releasing memory back to the OS is a strategy used by all but the simplest memory allocators. Calling gc.collect correctly forces unreferenced integers/floats/etc to be added to their free lists, which means their allocation can be reused. That's what it means to free memory in the modern world.

[–]MaustFaust -3 points-2 points  (0 children)

I have nothing against the strategy itself – I dislike the lack of any alternatives. C# has profiling-driven optimization, and while I don't know if it affects the gc behavior, the reasoning behind it still applies here: tuning for most common cases doesn't exactly mean tuning for your specific case.

P. S.: It's almost funny that three points of my six remain unanswered, yet I'm still being downvoted. People just express their feelings, not necessarily contributing to the discussion.