0

I am running eclipse Version: 3.8.1 in Linux Ubuntu and eclipse Luna 4.4.1 on my Macbook air laptop . When I am using the System.gc() in my code inside the Ubuntu I am receiving faster output but when I test it in my mac ,the results are worse .What could be the reason ?

  • 2
    First of all, direct calls to `System.gc()` are seen as "bad practice" by many folks ( http://stackoverflow.com/questions/2414105/why-is-it-bad-practice-to-call-system-gc ) To answer your question: obviously, the java implementations for Linux and Mac OS are different; therefore you end up with different behavior (another reason to **not** rely on calling System.gc()). You might want to specify the exact java versions that you are using on those operating systems. – GhostCat Mar 31 '15 at 11:47
  • 2
    May be it is not a matter of garbage collector but rather a simple difference in CPU/RAM between the two computer – ortis Mar 31 '15 at 11:49
  • I know it is a bad practice ,but I was given a task to maximize code performance. I am coding under consumption that the code is written in a bad way, therefore I am using the System.gc call .I can see from Yourkit profiler on my mac that the CPU time is higher and more memory is allocated on the heap ,garbage collector is working more time ,number of collections is higher.But in Ubuntu the performance still better ,how can it be?I am running Ubuntu eclipse sdk Version: 3.8.1.dist – Arthur Geng Mar 31 '15 at 12:14
  • are we even talking about performance of eclipse itself here? also, GC performance characteristics are highly subject to the selected garbage collector and various tuning parameters, so calling system.gc may simply end up altering the GC's behavior which could also be achieved by tuning VM options. you should post more information – the8472 Mar 31 '15 at 17:44

0 Answers0