Jump to content

What exactly is a memory leak and how do i fix it?


brandon3055

Recommended Posts

I just discovered a problem with my packet system and im hoping someone here can help figure out how to fix it.

 

First off what exactly dose this mean?

[06:46:21] [server thread/ERROR] [FML]: Detected ongoing potential memory leak. 100 packets have leaked. Top offenders
[06:46:21] [server thread/ERROR] [FML]: 	 DraconicEvolution : 100
[06:47:33] [server thread/ERROR] [FML]: Detected ongoing potential memory leak. 200 packets have leaked. Top offenders
[06:47:33] [server thread/ERROR] [FML]: 	 DraconicEvolution : 200
[06:47:49] [server thread/ERROR] [FML]: Detected ongoing potential memory leak. 300 packets have leaked. Top offenders
[06:47:49] [server thread/ERROR] [FML]: 	 DraconicEvolution : 300
[06:48:03] [server thread/ERROR] [FML]: Detected ongoing potential memory leak. 400 packets have leaked. Top offenders
[06:48:03] [server thread/ERROR] [FML]: 	 DraconicEvolution : 400
[06:48:43] [server thread/ERROR] [FML]: Detected ongoing potential memory leak. 500 packets have leaked. Top offenders
[06:48:43] [server thread/ERROR] [FML]: 	 DraconicEvolution : 500

It pops up whenever i click a button in one of my guis 100 times (so for every 100 packets sent)

 

I am using SanAndreasP's packet handling system (it was suggested by SanAndreasP not sure who came up with it)

 

 

I am the author of Draconic Evolution

Link to comment
Share on other sites

I am not using the Diesieben07's system the system i am using is very similar to this tutorial.

http://www.minecraftforge.net/wiki/Netty_Packet_Handling

 

I did some checking and that system is still used by CofhCore and Tinkerers Construct so it cant be that bad can it?

 

The difference with the version i am using is it uses an interface instead of the abstract packet.

 

Is there any reason i cant keep using this system? because i really dont want to have to re write my entire packet system again.

I am the author of Draconic Evolution

Link to comment
Share on other sites

By the way, a memory leak occurs with the software program continues to allocate memory for use without ever freeing it up again.  So the amount of memory used by the program grows until the system can't handle it anymore and crashes.

 

Memory leaks are often a result of poor buffer management.  For example, if you're doing file I/O operations and keep opening up stream buffers for reading without ever closing them, or similarly with networking that usually uses buffers for the message payloads.  I'm not really certain how the memory leak occurred in that problematic packet system that we all used for a while, but it likely was similar issue with buffer allocations not being freed up.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Hi

 

THat message isn't actually a memory leak error.  It tells you that you are receiving a message but don't have a handler registered for it on that side.

 

If you search the Forge code for that error message string, and put a breakpoint there, you can inspect the packet (IMessage) it's currently processing to find out which IMessage has the missing handler.

 

-TGG

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.