Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12

Thread: LUA Memory usage warning: Ideas?

  1. #11
    Basic Member
    Join Date
    Oct 2016
    Posts
    203
    i have been changing my skill use formats the last few days and have been adding a lot more "for npcEnemy do" to skill use, but removing a lot of table hero calls, my VM is rising quicker than it used to.
    i never had VM problems before i added the dodge AOE script, but seem to just be making things worse.

    i kind of wish i knew what i was looking at when i use print_r, etc, etc. :sad:

  2. #12
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,758
    Chris, I noticed Bot:GetLocation() generates a new Vector userdata reference even though the location remains unchanged.
    While I assume the userdata gets created on the fly, I expect a new handle creation, let's say over each frame, would be costly on the long run (imagining 10 locations - 1 for each player, with a "decent" 30 FPS timeframe over a 45 minute long game would quite add up), not to mention that they would ,eventually, get out of scope, which means new GC - and from what I heard, the GC is quite strict as it checks for mutual unreachable references to make sure it does proper cleaning. I, of course, excluded additional functions that use vectors (such as projectile helpers, GetAOELocation, avoidance zones etc.) which would mean even more allocations/GCs for vectors.
    Assuming it can be done, would you think caching locations until they change could reduce some overhead ?

    Using the Bot:GetLocation() references and passing them over to helper functions might also help, but it might also be risky as someone might be crazy enough to do math operations and assignments on vectors returned by them (and since they are passed by reference, might mess up other functions that use said references - although such crazy coding should not even be attempted and this behavior might serve as a deterrent - so your choice on the matter, if, say, the location returned by a helper functions should be the same reference as the one returned by Bot:GetLocaiton()).

    Obviously, a reward-vs-effort analysis should be considered, but it's a thought.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

Posting Permissions

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