• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.gc()

 
Eric Sexton
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy. I've been doing some tweaks to an app hear at work. BTW, my app is served from 1 machine and not a product that we sell, so however it works on our app server is how it works. I also know all about System.gc() is just a request, not a guarantee. Anyhow, I noticed that if I put the call to System.gc in part of my code, when the app starts up I have about 10 megs more of memory freed up than with not doing it. My question is, am I suffereing too much of a performance hit to use GC at this point to only save 10 megs?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12098
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"too much" is a very vague term. too much for what? if you have 2k of free memory without doing it, and 10.002Meg of free memory with it, then i'd say probably not (although you probably have other issues).
how important is performance to this app? will somebody die if it takes it an extra millisecond? are there other places where performance is being effected?
I don't think there's really enough info in your post to give ANY kind of answer. you may want to look at some of the profiling tools available, and actually measure performance under different conditions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic