Results 1 to 7 of 7

Thread: What increases ram and cpu usage?

  1. #1
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default What increases ram and cpu usage?

    Have been scripting for a while now. I'd like to minimize the script ram and cpu usage as low as it can be. But I'm not sure what in a script that would cause them to increase, other than dtm or bitmap.

    I have been starting and freeing my dtm with this method
    Simba Code:
    begin
      SetupLogin;
      AddOnTerminate('FreeAllDTM');
      AddOnTerminate('TakePhoto');
      StartAllDTM;

      repeat
        MainLoop;
      until not LoggedIn;
    end.
    It uses around 500b-550mb ram usage. So I thought only start when using them and free them after used would be more efficient. I started the dtm only in procedure that use it and free them at the end of the procedure. I see results, using only 400mb++, which is better than my normal method. But after few hours, its using 700mb+

    So I'd like to have some advices or suggestions. What would increase the resource usage in a script? And how can I reduce them?
    I used 7 DTMs in total
    SPS and ODTM walking, radialwalking as backup
    Removed painting smart
    TPA
    Only one symbol finding
    Others are just srl functions, and 1.3k lines script
    Last edited by CephaXz; 06-10-2012 at 10:07 AM.

  2. #2
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Every single function or procedure you use increases CPU usage, things like color finding for example.
    The memory issue is probably due to Runescape, SMART is going to appear separately from Simba in the task manager after the next update so you can see how much memory your script uses then.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  3. #3
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    You are also likely to have not freed a/an DTM(s) properly; as a symptom of not freeing them correctly will increase your ram over time, as you stated in the OP. AddOnTerminate simply free's the DTM's you have selected to free when you press the stop button or hit f2 in the running simba script. My suggestion would be to overview your DTM's and possibly set/free them more/right. If you need help, I could try assisting too.

    Cheers

  4. #4
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    You are also likely to have not freed a/an DTM(s) properly; as a symptom of not freeing them correctly will increase your ram over time, as you stated in the OP. AddOnTerminate simply free's the DTM's you have selected to free when you press the stop button or hit f2 in the running simba script. My suggestion would be to overview your DTM's and possibly set/free them more/right. If you need help, I could try assisting too.

    Cheers
    I thought starting all dtm at the start of the script and freeing them when script is terminated is the best way since you don't need to load and free them everytime you need to use that function/procedure.

    So you're recommending me to load and free inside a procedure/function instead of loading all at once and free after terminated?

  5. #5
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by CephaXz View Post
    I thought starting all dtm at the start of the script and freeing them when script is terminated is the best way since you don't need to load and free them everytime you need to use that function/procedure.

    So you're recommending me to load and free inside a procedure/function instead of loading all at once and free after terminated?
    When a script stops (ie terminated), all the DTMs and bitmaps are released anyway. Loading them once should be enough. The only way to screw up memory is to use DTMFromString(**) every time you use a DTM. At least that's what I was told when asked about it.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  6. #6
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by litoris View Post
    When a script stops (ie terminated), all the DTMs and bitmaps are released anyway. Loading them once should be enough. The only way to screw up memory is to use DTMFromString(**) every time you use a DTM. At least that's what I was told when asked about it.
    They still need to be freed, otherwise they just be sitting there unnecessarily hogging your memory.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  7. #7
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    1,199
    Mentioned
    0 Post(s)
    Quoted
    26 Post(s)

    Default

    Would the proper use of DTMs be to setDTM := DTMfromstring=(...) in a procedure and then free it at the end of that procedure? Like in the script I am using I use the same DTM in two different procedure, so I can understand using that one as a Global but other I use are only used for a single procedure, so would it be better to load and free those DTMs within that procedure?

    Simba Code:
    Procedure SetDTM; //Sets all the DTMS needed to run the script.
    Begin

      SummoningPotionDTM := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');
      ROWDTM:= DTMFromString('mrAAAAHic42BgYPjHxMDAzAzBf4DsL0D8CYi/A/EvIJ7HyMAwE4gXAfEqIF4OxAuAeDYQzwDi23vlgKYw4cT8DPgBIwEMAwClEwzS');
      TABLEDTM:= DTMFromString('mrAAAAHic42BgYLjAxMBwH4gvA/FxID4MxOeA+CZUfBEjA8NqIF4DxXOAeAYUzwLiesE6oClMODEPA37ASADDAADlrQzu');
      WarTortPouch := DTMFromString('mbQAAAHicY2VgYDAFYisg1gNiGyC2BuL3QPwEiD8A8RcgfgfEna4iDFfO7GDQ15BnaHcRAWN+oDg6ZsSCwQAAEz8LfQ==');
    End;

    Only the TABLEDTM really needs to be global so would that be better to have only that one loaded globally and load the other only when necessary?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •