Thread: Multiple Java Processes Hogging RAM

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Multiple Java Processes Hogging RAM 
    ryannathans
    Guest
    REP+ to who fixes this

    hi when my server resets by itself it seams to creatate another java process and leave the others running. EG after 7 hours of running and restarting i would have like 20java processes hogging ram and mazing it out. im not sure why this happens? can someone please look at this and give me a solution? thanks.

    ANTILAG.JAVA

    Code:
    import java.io.*;
    
    public class antilag
    {
    
    public int ResetTimer = 0;
    
    public void resetserver()
    {
    PlayerHandler.kickAllPlayers = true;
    misc.println("Restarting PK PerthScape.");
    ResetTimer = 0;
    closeListener();
    runserver();
    }
    public void process()
    {
    ResetTimer += 1;
    if(ResetTimer >= 14000)
    {
    resetserver();
    }
    }
    
    public void runserver()
    {
    try 
    {
    String run = "Run.bat";
    String xstr = "./"+run;
    Runtime.getRuntime().exec(xstr);
    } 
    catch (IOException ioe) 
    {
    ioe.printStackTrace();
    } 
    }
    
    public void closeListener()
    {
    try {
    server.shutdownClientHandler = true;
    if(server.clientListener != null) server.clientListener.close();
    server.clientListener = null;
    } 
    catch(java.lang.Exception __ex) 
    {
    __ex.printStackTrace();
    }
    }
    }
    Reply With Quote  
     

  2. #2  
    Codex
    Rowan's Avatar
    Join Date
    Sep 2008
    Age
    28
    Posts
    1,593
    Thanks given
    0
    Thanks received
    20
    Rep Power
    1092
    I'm not sure but I think your antilag just closes the run.bat and not the process .
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Aug 2007
    Posts
    2,395
    Thanks given
    2
    Thanks received
    63
    Rep Power
    558
    make sure you close all you threads when it starts up a new server
    Reply With Quote  
     

  4. #4  
    ryannathans
    Guest
    what it does is on the console window it says SHUTTING DOWN... then RESTARTING... and that window does not close or anything but the window become inactive... eg it does not show new events... Why should i need the server to restart?
    Reply With Quote  
     

  5. #5  
    Community Veteran

    Cascade's Avatar
    Join Date
    Oct 2006
    Posts
    1,022
    Thanks given
    12
    Thanks received
    27
    Rep Power
    912
    In your run.bat have this I think:

    Code:
    @echo off
    taskkill /f /im java.exe
    java server
    Reply With Quote  
     

  6. #6  
    ryannathans
    Guest
    'taskkill' is not recognized as an internal or external command,
    operable program or batch file.

    help?

    my normal thing is
    Code:
    @echo off
    title PK PerthScape Server
    color 0e
    java -Xmx512m -cp .;./Class; server
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Jul 2006
    Age
    30
    Posts
    1,247
    Thanks given
    0
    Thanks received
    5
    Rep Power
    190
    delete antilag and your done
    just yoricka...
    Reply With Quote  
     

  8. #8  
    ryannathans
    Guest
    why delete anti lag?

    EDIT**

    if i delete it and i compile i get 100 errors...

    EDIT**

    whats another way of getting run.cmd to kill a task?
    Reply With Quote  
     

  9. #9  
    Community Veteran

    Cascade's Avatar
    Join Date
    Oct 2006
    Posts
    1,022
    Thanks given
    12
    Thanks received
    27
    Rep Power
    912
    Quote Originally Posted by ryannathans View Post
    'taskkill' is not recognized as an internal or external command,
    operable program or batch file.

    help?

    my normal thing is
    Code:
    @echo off
    title PK PerthScape Server
    color 0e
    java -Xmx512m -cp .;./Class; server
    Ahhh okay then, replace your current runserver() method with this one..

    Code:
    public void runserver()
    {
    try 
    {
    String run = "Run.bat";
    String xstr = "./"+run;
    Runtime.getRuntime().exec(xstr);
    System.exit(0);
    } 
    catch (IOException ioe) 
    {
    ioe.printStackTrace();
    } 
    }
    That should work.
    Reply With Quote  
     

  10. #10  
    ryannathans
    Guest
    thanks... i will go off to airport now and check if my ram is maxed when i get back
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •