Jump to content

Tips for reducing memory use


PlumpRump

Recommended Posts

I want to get some advice from more experienced scripters about how to reduce the RAM usage in my scripts. I am running them on a linux machine with 16gig.  Usually they start at around 500mb and grow to 1200mb or higher over several hours. This is a serious problem, as I may start a certain number of scripts and then when I come back several hours later, many of them are no longer running due to memory running out. I'd like to at least stem the memory growth, and possibly reduce the overall memory use if that's possible. So far I've seen several suggestions on here, namely using cli flags like lowresource, turning off sound, and eliminating webwalk. I've done the first two, so I suspect my memory problems come down to webwalk.

As far as I can tell, webwalk isn't releasing any memory, because the memory use doesn't reduce when webwalk ends. Is there any way to clear out the webwalk memory when it isn't in use? Would it be possible to replace the object(s) responsible for webwalking so that the garbage collector can free up that memory? I don't care if this increases CPU use, as memory is the current bottleneck

If clearing the webwalk memory isn't possible, my only option then might be to replace webwalk with walkpath wherever possible. My concern with this is that I still need to use webwalk in certain instances, such as when the bot starts at an unknown location. I'm worried even a single call will hog up a ton of memory that it will never let go. Will simply calling webwalk once in the entire script render implementing walkpath pointless? Is it worth my time to remove most calls to webwalk without necessarily removing all of them?

If nothing else works, I'm considering just having my scripts end themselves after like an hour, and then restart as a way to clear memory. Is it possible to do this within the OSBot api, or do I need to have an external program restart them?

Let me know if you have any other advice on reducing memory usage/growth

Link to comment
Share on other sites

2 minutes ago, Night said:

I'm going to guess you're using webwalker, removing that in favor of local walking or manual paths.

There are some cases where webwalk is unavoidable though. For example, if my script is stopped while my bot is between the harvesting location and the bank. When the script starts again, I will have to use webwalk. I want to know whether even this one call will hog up tons of memory and never let it go, rendering the switch to manual paths useless. If not, or if there's some way I can free the memory, then maybe a switch to manual paths will be worth the effort.

Link to comment
Share on other sites

Just now, PlumpRump said:

There are some cases where webwalk is unavoidable though. For example, if my script is stopped while my bot is between the harvesting location and the bank. When the script starts again, I will have to use webwalk. I want to know whether even this one call will hog up tons of memory and never let it go, rendering the switch to manual paths useless. If not, or if there's some way I can free the memory, then maybe a switch to manual paths will be worth the effort.

You can start a path midway through it

  • Like 1
Link to comment
Share on other sites

1 minute ago, Night said:

You can start a path midway through it

Interesting idea, I didn't think of that. Maybe something like:

If bot is not in bank or harvest area, find closest point on path to bot location. If this location is visible, start path from that location, else webwalk.

I'd still like to see answers to my other questions, but thanks for that tip.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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