Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Bug Mystery memory leak stealing from tea stall

Joined
Aug 23, 2015
Messages
1,970
The following bot runs fine at first. After about 10min I'm down to about 1fps, and after about 20 my Runemate client freezes and intellij says runemate ran out of accessible memory.

Issue started happening a couple weeks ago in one of my related bots. Haven't had time to troubleshoot until now. I started off with my actual bots code and removed everything unnecessary (such as UIs) and freezing still occurred. Then I removed all of my own API code and freezing still occurred. I can currently reproduce the issue running a bot with just the following code:

Code:
public class StallBot extends LoopingBot {

    private final static String tea = "Cup of tea";
    private final static Coordinate nearTeaStall = new Coordinate(3268, 3410, 0);
    private GameObject stall;

    @Override
    public void onStart(String... arguments) {
        getLogger().info("Running new bot");
        Mouse.setPathGenerator(Mouse.MLP_PATH_GENERATOR);
    }

    @Override
    public void onLoop() {
        if(Inventory.isFull()) {
            List<SpriteItem> toDrop = Inventory.newQuery().names(tea).results().sortByIndex().asList();
            for (SpriteItem item:toDrop){
                Execution.delay(40, 100, 55);
                 if(!Keyboard.isPressed(VK_SHIFT)){
                     Keyboard.pressKey(VK_SHIFT);
                 }
                 item.click();
                 Execution.delay(40, 100, 55);
            }
            Keyboard.releaseKey(VK_SHIFT);
        } else if(Distance.to(nearTeaStall) < 1.5){
            stall = GameObjects.newQuery().names("Tea stall").actions("Steal-from").results().first();
            if(stall != null && stall.interact("Steal-from")){
                getLogger().info("Stealing tea from "+stall);
                Execution.delayUntil(()->!stall.isValid(), ()-> Players.getLocal().getAnimationId() == 832, 1500, 3500);
            } else {
                getLogger().info("Waiting for tea to respawn");
            }
        } else {
            getLogger().info("Too far from tea stall");
        }
    }

}

@Cloud posting here so it doesn't get lost in the depths of slack. I don't think this is appropriate for a git issue but I'll make one if requested
 
Top