Jump to content

Reducing the Memory Leak.


Failure

Recommended Posts

You guys do know that in Java there is a garbage collector that deallocates unused objects from memory automatically whenever necessary.. What you are all referring to as "memory leaks" are probably not so. As for the application/s suggested in this thread, you should probably do some research on how they actually work.. If anything, they are counter-productive.

  • Like 1
Link to comment
Share on other sites

How does this help/affect your bots/computer? Sorry I'm not so good with computers :$

 

Please don't say it reduces memory leak because idk what that really means either smile.png

 

I explained this if you look on the first page of the thread. It just frees up more ram for your pc to use on other things. That is assuming there is a memory leak. Either way I think it will help for low ram computers. I have 16 gigs so I dont use this often :P

Link to comment
Share on other sites

You guys do know that in Java there is a garbage collector that deallocates unused objects from memory automatically whenever necessary.. What you are all referring to as "memory leaks" are probably not so. As for the application/s suggested in this thread, you should probably do some research on how they actually work.. If anything, they are counter-productive.

 

Well you can call it from: System.gc();. But anyways, this is not always the problem; sometimes it is a thread never being closed or a rescoure type like Scanner class or Inputstreams that are never being closed.. System.gc() from what i recall doesn't deallocate the memory used by those objects, not to mention if they are storing things in large array lists (which they are...) Recursive classes will become an issue and have 5 class objects with Arrays that are 10000+ in length lol.

 

Link to comment
Share on other sites

 

You guys do know that in Java there is a garbage collector that deallocates unused objects from memory automatically whenever necessary.. What you are all referring to as "memory leaks" are probably not so. As for the application/s suggested in this thread, you should probably do some research on how they actually work.. If anything, they are counter-productive.

 

Well you can call it from: System.gc();. But anyways, this is not always the problem; sometimes it is a thread never being closed or a rescoure type like Scanner class or Inputstreams that are never being closed.. System.gc() from what i recall doesn't deallocate the memory used by those objects, not to mention if they are storing things in large array lists (which they are...) Recursive classes will become an issue and have 5 class objects with Arrays that are 10000+ in length lol.

 

 

 

The garbage collector will run regardless of whether or not you call System#gc. In fact, calling System#gc does not even guarantee the garbage collector will run at that given time - relying on this statement in your application is usually an indicator of bad code, and a bad programmer. The rest of your reply is not relevant to the thread - Failing to close a stream is trivial, and allocating a huge array, will simply be deallocated from memory when appropriate.

 

Since no one has looked up what these actually do, I may as well tell you that all they do is indicate the operating system to move blocks of memory to your hard disk - something that will automatically occur when you're low on memory. This will incur a huge penalty when the memory is accessed again. These applications may be useful for detecting memory leaks, but are not particularly useful when accidentally creating a memory leak in Java is near impossible.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...