Jump to content

INodeRouteFinder caused memory leak:(


Recommended Posts

Posted
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.webwalk.INodeRouteFinder;
import org.osbot.rs07.event.WebWalkEvent;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.utility.Condition;



public class Runtoblurite extends Task {
	public void WebWalkCustom(Position p){
		INodeRouteFinder nrf = INodeRouteFinder.createAdvanced();
		 WebWalkEvent e = new WebWalkEvent(nrf, p);
		 e.setBreakCondition(new Condition() {
		            @Override
		            public boolean evaluate() {
		            	boolean flag = false;
		            	if(api.getSkills().getDynamic(Skill.HITPOINTS) <= api.getSkills().getStatic(Skill.HITPOINTS)*.7&& !(api.myPlayer().getPosition() == new Position(3059,9565,0))){
		            		flag = true;
		            	}
		                return flag; //stops when true
		        }
		            });
		        api.execute(e);
		}
	public Runtoblurite(MethodProvider api) {
		super(api);
	}

	@Override
	public boolean canProcess() {
		boolean flag = false;
        if(api.settings.getConfigs().get(122) == 6 && this.api.getSkills().getDynamic(Skill.MINING)>= 10 && !api.inventory.contains("Portrait")&& !api.inventory.contains("Blurite ore")&&!api.inventory.contains("Blurite sword")){
        	flag = true;
        }
		return flag;
	}

	@Override
	public void process() {
		   api.log("Running to mine");
		   WebWalkCustom(new Position(3059,9565,0));
			   	
	}
}

Hey there INodeRouteFinder caused a memory leak for me and used up all my heap space

Posted

The issue is that you are creating the inoderoutefinder every time you walk.

 

You need to make one only onStart() once. Then maybe add it to your class that contains your variables

public class test extends Script{
    INodeRouteFinder nrf;
    
    public void onStart(){
        nrf = INodeRouteFinder.createAdvanced();
    }
} 
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...