Thread: [PI]Memory Leak , What is causing it

Results 1 to 5 of 5
  1. #1 [PI]Memory Leak , What is causing it 
    Super Donator

    Jack Daniels's Avatar
    Join Date
    Oct 2010
    Posts
    1,842
    Thanks given
    787
    Thanks received
    507
    Rep Power
    412
    So, ive been trying to find the PI memory leak for some time now

    Today when I was checking my memory using Visual VM
    and then I went to make a heap dump and this way I could
    check literally what objects were being created and howmany instances there
    were

    This way I saw that my server actually had 3500 Client/Player Objects
    while only having 150 ppl online

    Whenever you clicked on one of these Objects you could also see
    its variables and they werent null

    So PI must be not deleting these unused objects

    How can I make it do it and why isnt it deleting them? :O

    5 Minutes after restarting my server (having 191 players online)
    my Visual VM was showing this:


    After 15 hours of server running the instances amount was 3500
    This explains char[],int[],String[],byte[] as most used Memory Stuff



    Code:
    			case 9154:
    			c.logout(); 
    			c = null; 
    			if(System.currentTimeMillis() - lastTimeGCED > 5000){
    				lastTimeGCED = System.currentTimeMillis();
    				System.gc();
    			}
    			break;
    This doesnt seem to help :\

    Since my Player class is 2144 lines long , just full of declarations of variables and a few methods and
    Client class 1154 lines I think this is using about 500kb/Client object


    New Skype : samar.server
     

  2. #2  
    Donator


    Join Date
    Feb 2009
    Age
    30
    Posts
    2,128
    Thanks given
    261
    Thanks received
    280
    Rep Power
    563
    no need for another garbage collecter as its already being done in your debug method.

    Code:
    private static void debug() {
    		if (debugTimer.elapsed() > 360*1000) {
    			long averageCycleTime = totalCycleTime / cycles;
    			System.out.println("Average Cycle Time: " + averageCycleTime + "ms");
    			double engineLoad = ((double) averageCycleTime / (double) cycleRate);
    			System.out.println("Players online: " + PlayerHandler.playerCount+ ", engine load: "+ debugPercentFormat.format(engineLoad));
    			totalCycleTime = 0;
    			cycles = 0;
    			System.gc();
    			System.runFinalization();
    			debugTimer.reset();
    		}
    	}
     

  3. #3  
    Super Donator

    Jack Daniels's Avatar
    Join Date
    Oct 2010
    Posts
    1,842
    Thanks given
    787
    Thanks received
    507
    Rep Power
    412
    Yeah , but since the Garbage collector doesnt delete Client objects.........


    New Skype : samar.server
     

  4. #4  
    Super Donator

    Jack Daniels's Avatar
    Join Date
    Oct 2010
    Posts
    1,842
    Thanks given
    787
    Thanks received
    507
    Rep Power
    412
    b u m p


    New Skype : samar.server
     

  5. #5  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. SQL logout saving causing leak
    By myK- in forum Help
    Replies: 7
    Last Post: 02-15-2011, 12:30 AM
  2. [PI] Memory Leak
    By Clockwork in forum Help
    Replies: 11
    Last Post: 02-08-2011, 07:33 AM
  3. [PI] Memory Leak
    By I'm A Jerk in forum Help
    Replies: 0
    Last Post: 01-23-2011, 11:43 PM
  4. $25 for a memory leak fix.
    By The Situationist in forum Help
    Replies: 4
    Last Post: 12-05-2010, 10:56 PM
  5. Memory Leak
    By Neekage in forum Help
    Replies: 9
    Last Post: 06-11-2010, 08:32 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •