1

I'm looking for some code or some benchmark to roughly asses the pause times or cpu load caused by some GC in order to get some rough estimate how efficient it is. I just want to see whether some GC has really large pause times or not. That would be sufficient.

Some language like Java or C# allow for lots of logging information to be written to the console which can then be analysed. But for some open source languages without commercial backing from some large company this is often not the case.

So in order just to get some rough estimate I would run some code that does some arbitrary computation like running the number crunching code of some benchmark. Then I would load the heap in parallel with a lot of data like creating large arrays of strings, because strings consume a lot of memory and the GC will somewhen be forced to free memory and then I can have a look how long the execution time is taking with causing pressure on memory and without.

My question is whether someone has some idea for a better approach. Maybe some GC benchmark code exists that I can adapt to the respective language.

1 Answer 1

3

You might want to take a look at the Binary Trees benchmark from the Benchmarks Game. It's a good stress test for garbage collectors, especially when implemented with multiple threads.

The benchmark creates many binary trees of varying sizes — some short-lived and some long-lived — which puts memory pressure on the GC in a realistic way.

You can easily adapt the code to different languages, and even tweak the memory pressure or concurrency to test GC behavior under various conditions.

Sign up to request clarification or add additional context in comments.

1 Comment

Perfect, didn't know that. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.