Thread: Vencillio mining crashing and lagging regions / memory leak

Results 1 to 10 of 10
  1. #1 Vencillio mining crashing and lagging regions / memory leak 
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Each time you mine an ore with a replacement object id, the server adds a new object to be spawned, however it does not remove existing objects before spawning a new one. This results in a huge pile up of objects being spawned for the player mining and new players entering the region, in worst case scenarios it crashes the client entirely. This will also obviously cause an unwanted memory leak as the "active" object list will grow indefinitely whilst players are mining.


    Where both the depleted rock and normal rock are spawned add this above.

    Code:
    GameObject gameObject = ObjectManager.getGameObject(object.getX(), object.getY(), object.getZ());
    if(gameObject != null) {
        ObjectManager.removeFromList(gameObject);
    }
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Thanks for the share.
    Reply With Quote  
     

  4. #3  
    Registered Member LordSlaughter's Avatar
    Join Date
    Aug 2016
    Posts
    141
    Thanks given
    20
    Thanks received
    14
    Rep Power
    13
    Thanks for the contribution

    Your New Favorite Time Waster!

    "Don't look at the finish line, look at the steps along the way" - Zivik
    Reply With Quote  
     

  5. #4  
    ⚓Manic-Owner⚓


    Join Date
    Nov 2007
    Posts
    2,711
    Thanks given
    47
    Thanks received
    9
    Rep Power
    650
    Quote Originally Posted by Stuart View Post
    Each time you mine an ore with a replacement object id, the server adds a new object to be spawned, however it does not remove existing objects before spawning a new one. This results in a huge pile up of objects being spawned for the player mining and new players entering the region, in worst case scenarios it crashes the client entirely. This will also obviously cause an unwanted memory leak as the "active" object list will grow indefinitely whilst players are mining.


    Where both the depleted rock and normal rock are spawned add this above.

    Code:
    GameObject gameObject = ObjectManager.getGameObject(object.getX(), object.getY(), object.getZ());
    if(gameObject != null) {
        ObjectManager.removeFromList(gameObject);
    }
    would that be in the mining class above this:

    Code:
    ObjectManager.spawnWithObject(ore.getReplacement(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
    and this:

    Code:
    ObjectManager.spawnWithObject(object.getId(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
    Reply With Quote  
     

  6. #5  
    Member
    Join Date
    Jan 2017
    Posts
    56
    Thanks given
    7
    Thanks received
    4
    Rep Power
    0
    I'm trying to implement this, I'm cannot find symbol error pointing at object.getY(). Any help, should I be able to paste this code in with no other changes and it works?
    Reply With Quote  
     

  7. #6  
    Registered Member

    Join Date
    Dec 2016
    Posts
    132
    Thanks given
    39
    Thanks received
    54
    Rep Power
    100
    Quote Originally Posted by knd6065 View Post
    I'm trying to implement this, I'm cannot find symbol error pointing at object.getY(). Any help, should I be able to paste this code in with no other changes and it works?
    Try object.getLocation().getY()
    Reply With Quote  
     

  8. #7  
    Member
    Join Date
    Jan 2017
    Posts
    56
    Thanks given
    7
    Thanks received
    4
    Rep Power
    0
    It's alright, I found the problem. Everything was fine except i didn't import GameOblect class. Do everything Mystic Maze does above and make sure you have
    Code:
    import com.vencillio.rs2.entity.object.GameObject;
    for future people.
    Reply With Quote  
     

  9. #8  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Good job Stuart, recently solved this for Figgatt's OS-Fidelity. Here is a bit more detail. The ObjectManager#spawnWithObject was changed to return the object being spawned for later use.

    Code:
                            GameObject removeExisting = ObjectManager.getGameObject(new Location(object.getX(), object.getY(), object.getZ()));
    
    
                            if (removeExisting != null) {
                                ObjectManager.removeFromList(removeExisting);
                            }
                            final GameObject replace = ObjectManager.spawnWithObject(ore.getReplacement(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
    
    
                            TaskQueue.queue(new Task(player, ore.getRespawn(), false, StackType.STACK, BreakType.NEVER, TaskIdentifier.MINING_ROCK) {
                                @Override
                                public void execute() {
                                    stop();
                                }
    
    
                                @Override
                                public void onStop() {
                                    ObjectManager.removeFromList(replace);
                                    ObjectManager.spawnWithObject(object.getId(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
                                }
                            });
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Donator

    i dds you's Avatar
    Join Date
    Jun 2013
    Posts
    831
    Thanks given
    678
    Thanks received
    160
    Rep Power
    92
    Quote Originally Posted by Jason View Post
    Good job Stuart, recently solved this for Figgatt's OS-Fidelity. Here is a bit more detail. The ObjectManager#spawnWithObject was changed to return the object being spawned for later use.

    Code:
                            GameObject removeExisting = ObjectManager.getGameObject(new Location(object.getX(), object.getY(), object.getZ()));
    
    
                            if (removeExisting != null) {
                                ObjectManager.removeFromList(removeExisting);
                            }
                            final GameObject replace = ObjectManager.spawnWithObject(ore.getReplacement(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
    
    
                            TaskQueue.queue(new Task(player, ore.getRespawn(), false, StackType.STACK, BreakType.NEVER, TaskIdentifier.MINING_ROCK) {
                                @Override
                                public void execute() {
                                    stop();
                                }
    
    
                                @Override
                                public void onStop() {
                                    ObjectManager.removeFromList(replace);
                                    ObjectManager.spawnWithObject(object.getId(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
                                }
                            });
    Thanks for sharing Jason, also fixed this & Woodcutting alongside it a while ago thanks to _Stan

    Hope you can share some other weird and wonderful bug finds whilst working with Figgatt, There are many
    Reply With Quote  
     

  12. Thankful users:


  13. #10  
    Registered Member
    Join Date
    May 2017
    Posts
    91
    Thanks given
    36
    Thanks received
    4
    Rep Power
    33
    Quote Originally Posted by Mystic_Haze View Post
    would that be in the mining class above this:

    Code:
    ObjectManager.spawnWithObject(ore.getReplacement(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
    and this:

    Code:
    ObjectManager.spawnWithObject(object.getId(), object.getX(), object.getY(), object.getZ(), object.getType(), object.getFace());
    its normal if i finish mining ore then server says this : [[I@764b9f58] and this after each ore mined?

    Quote Originally Posted by Stuart View Post
    Reply With Quote  
     


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. Replies: 3
    Last Post: 05-05-2011, 02:50 AM
  2. [$25] Memory leak char[] and object[] Fix [PI]
    By MrClassic in forum Requests
    Replies: 4
    Last Post: 03-22-2011, 07:58 PM
  3. Replies: 9
    Last Post: 03-22-2011, 07:00 PM
  4. Replies: 1
    Last Post: 02-06-2011, 11:52 AM
  5. Lag,Perhaps Memory leak
    By Neekage in forum Help
    Replies: 9
    Last Post: 08-10-2010, 03:37 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •