avid Posted December 5, 2017 Share Posted December 5, 2017 Ello all, thanks for stopping by! Running a combat script I made. Pretty new to programming within a JVM. However, task manager (windows) is reporting 1.9gigs of memory usage (with render turned off and low cpu)... Is my script just THAT BAD? I have web walking in a section, but it should only be called when we are outside of the combat area for whatever reason. if(!targetArea.contains(myPlayer()) && !myPlayer().isAnimating() && !myPlayer().isMoving()) { log("webwalk event"); WebWalkEvent evt = new WebWalkEvent(targetArea); evt.setBreakCondition(new Condition() { @Override public boolean evaluate() { return dialogues.inDialogue(); } }); execute(evt); } Is this causing 1.9 gigs of memory usage? Is there any way to manually GC while the event is not in use? Is there something else causing the massive memory usage? The filter for enemy acquisition? Surely the area's are stored as points in some way and not taking up globs of memory? Are there any other data structures I should be keeping an eye on for memory usage when using the API? Appreciate your experience, Avid Quote Link to comment Share on other sites More sharing options...
dreameo Posted December 5, 2017 Share Posted December 5, 2017 (edited) If you think this walking method might be the cause, then just comment it out and run the bot. Take a look at the usage and see if there's any difference. Anyways, you could try setting it as a global value and initiating it during onStart. That way you just call execute instead of creating it every time. (edit: ^ the walking event) Edited December 5, 2017 by dreameo Quote Link to comment Share on other sites More sharing options...
avid Posted December 5, 2017 Author Share Posted December 5, 2017 3 minutes ago, dreameo said: If you think this walking method might be the cause, then just comment it out and run the bot. Take a look at the usage and see if there's any difference. Anyways, you could try setting it as a global value and initiating it during onStart. That way you just call execute instead of creating it every time. (edit: ^ the walking event) Good idea! Does java work like that though, where it allocates memory for the object regardless of whether it's code block is entered? I guess that makes sense. (Been a while since I've worked in a pre-compiled language). I'll comment out the walking and see if that's the cause. If it is, could this be avoided via encasing the webwalk even in a function call? On that matter, would it be more memory efficient to hard code multiple paths through a dungeon and then only use the webwalker for banking? (rather than using the webwalker to enter/exit/navigate floors on the dungeon?) Quote Link to comment Share on other sites More sharing options...
dreameo Posted December 5, 2017 Share Posted December 5, 2017 1 minute ago, avid said: Good idea! Does java work like that though, where it allocates memory for the object regardless of whether it's code block is entered? I guess that makes sense. (Been a while since I've worked in a pre-compiled language). I'll comment out the walking and see if that's the cause. If it is, could this be avoided via encasing the webwalk even in a function call? On that matter, would it be more memory efficient to hard code multiple paths through a dungeon and then only use the webwalker for banking? (rather than using the webwalker to enter/exit/navigate floors on the dungeon?) It will only create it if it enters the block. webwalkers I think might be a bit expensive in creating. That's just the part of the code you showed so that's the only advice I could offer lol. Making a path is more efficient then a web walker. Just use the Walking class and do walkPath. 1 Quote Link to comment Share on other sites More sharing options...
ownage999 Posted December 5, 2017 Share Posted December 5, 2017 just 1,9GB of ram? thats nothing :^) 1 1 Quote Link to comment Share on other sites More sharing options...
avid Posted December 5, 2017 Author Share Posted December 5, 2017 I had a NPE going on in the combat portion. That was adding 1gig of memory usage! It's down to .9 gigs now. Which works for my setup right now. When I need to reduce it more, I'll fiddle with paths and walking instead of webwalker. Thanks again. 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted December 5, 2017 Share Posted December 5, 2017 25 minutes ago, avid said: I had a NPE going on in the combat portion. That was adding 1gig of memory usage! It's down to .9 gigs now. Which works for my setup right now. When I need to reduce it more, I'll fiddle with paths and walking instead of webwalker. Thanks again. Glad you figured it out. If you go to options>console you can bring up the console to see errors thrown (not sure if you knew this but I figured you might not have known if you posted here before finding the NPE!). Alternatively you can boot from cmd and have it print there, using System.out.println. In terms of walking, i'd suggest against using the webwalker liberally. As a general rule of thumb, the only occasion you should warrant using the webwalker is when you know where you are going but not where you are walking from. Use paths for the rest! Best Apa 1 Quote Link to comment Share on other sites More sharing options...
Charlotte Posted December 5, 2017 Share Posted December 5, 2017 For short distances, it's better to use paths to reduce resources used Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted December 8, 2017 Share Posted December 8, 2017 On 5-12-2017 at 5:13 PM, Charlotte said: For short distances, it's better to use paths to reduce resources used Okay? 1 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted December 9, 2017 Share Posted December 9, 2017 Web walker data is loaded once when its called initially, then its not deallocated because we expect the call to be made again. For detailed output don't use the logger, the logger is meant for non-scripters. Run OSBot in Command-Line to see detailed outputs. java -jar "osbot.jar -debug 5005" Quote Link to comment Share on other sites More sharing options...
Antonio Kala Posted December 9, 2017 Share Posted December 9, 2017 (edited) On 12/5/2017 at 10:12 AM, Apaec said: Glad you figured it out. If you go to options>console you can bring up the console to see errors thrown (not sure if you knew this but I figured you might not have known if you posted here before finding the NPE!). Alternatively you can boot from cmd and have it print there, using System.out.println. In terms of walking, i'd suggest against using the webwalker liberally. As a general rule of thumb, the only occasion you should warrant using the webwalker is when you know where you are going but not where you are walking from. Use paths for the rest! Best Apa Or just invest a little more money and use the webwalker all the time Like me! No more work required to do manual paths. Love the webwalker :). Edited December 9, 2017 by Antonio Kala Quote Link to comment Share on other sites More sharing options...
Apaec Posted December 9, 2017 Share Posted December 9, 2017 4 hours ago, Antonio Kala said: Or just invest a little more money and use the webwalker all the time Like me! No more work required to do manual paths. Love the webwalker :). That's a bad idea considering the complexity, memory usage and potential for fail! 1 Quote Link to comment Share on other sites More sharing options...