Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 3
    Minor nitpick: IMO "so that each test gets" should be "so that each test might get" since the former gives the impression that calling gc always frees up unused memory. Commented Apr 20, 2013 at 6:52
  • 1
    @SanjayT.Sharma: Well, the intention is that it actually does. While it's not strictly guaranteed, it's actually a pretty strong hint. Will edit to be clearer. Commented Apr 20, 2013 at 8:02
  • 2
    I don't agree with calling System.gc(). It is a hint, that's all. Not even "it will hopefully do something". You should never ever call it. This is programming, not art. Commented Jun 14, 2013 at 10:38
  • 16
    @gyabraham: Yes, it's a hint - but it's one which I've observed to usually be taken. So if you don't like using System.gc(), how do you propose to minimize garbage collection in one test due to objects created in previous tests? I'm pragmatic, not dogmatic. Commented Jun 14, 2013 at 10:58
  • 11
    @gyabraham: I don't know what you mean by "great fallback". Can you elaborate, and again - do you have a proposal to give better results? I did explicitly say that it's not a guarantee... Commented Jun 14, 2013 at 17:44