Log in

View Full Version : Memory Leak



miquel011
08-07-2014, 02:53 PM
I just clean this thread because i found the error, but i don't know how to fix that.
I added exori gran ico into targeting to delete 1 multiple spell, basically i noticed it ADDS KBs to my Memory usage when it change the target ( he's changing the target name over and over) But, i don't know if it's correct, but it adds over and over, so more targets = more RAM usage.
How the hell i fix that? spent over 5h already :/
The code looks like that now:



--[[Mages Multiple Strike Spells]]--


local targets = {"Swarmer", "Lesser Swarmer", "Insectoid Worker", "Waspoid", "Crawler", "Ladybug", "Spitter", "Kollos", "Spidris", "Spidris Elite", "Hive Overseer"}

-- Just change below to suit your needs.
local magia = {}
magia [1] = { spell = "exori ico" } --Max spell
magia [2] = { spell = "exori hur" } --Gran spell


Module.New("Multiple Strike Spells", function(module)
for _, data in ipairs(magia ) do
local c = Creature.GetByID(Self.TargetID())
if table.contains(targets, c:Name()) then
if c:DistanceFromSelf() <= 3 then
if Self.TargetID() ~= 0 then
for x=1, #magia do
if Self.CanCastSpell(data.spell) then
Self.Say(data.spell)
wait(500, 1500)
end
end
end
end
end
end
module:Delay(1000)
end)

miquel011
08-07-2014, 08:53 PM
Mega Edit. Found some information
DarkstaR

Im so sorry to waste your time, it's fast to solve but i don't know how >.<

ppgab
08-07-2014, 09:15 PM
miquel001 why loop trough magia twice?? o.O and dont use ipairs, specially if you wont even use the first parameter

you really should use Xenobot's own shooter, it has performance privileges and works wonders.

miquel011
08-07-2014, 09:22 PM
miquel001 why loop trough magia twice?? o.O and dont use ipairs, specially if you wont even use the first parameter

you really should use Xenobot's own shooter, it has performance privileges and works wonders.
How do i choose which spell to use? Im playing shadowcores using 10.38 version

Btw that multiple spell script is from this forum, im just editing it.

miquel011
08-07-2014, 09:31 PM
--[[Mages Multiple Strike Spells]]--
local targets = {"Swarmer", "Lesser Swarmer", "Insectoid Worker", "Waspoid", "Crawler", "Ladybug", "Spitter", "Kollos", "Spidris", "Spidris Elite", "Hive Overseer"}

-- Just change below to suit your needs.
local magia = {}
magia [1] = {spell = "exori ico", range = 1} --Max spell
magia [2] = {spell = "exori hur", range = 3} --Gran spell

Module.New("Multiple Strike Spells", function(module)
local c = Creature.New(Self.TargetID())
if (table.contains(targets, c:Name())) then
if (Self.TargetID() ~= 0) then
for i = 1, #magia do
if (Self.CanCastSpell(magia[i].spell) and c:DistanceFromSelf() <= magia[i].range) then
Self.Say(magia[i].spell)
wait(500, 1500)
end
end
end
end
module:Delay(1000)
end)
Thanks for your help.. but that's even worse... it raises 32kb by 32kb every second while attacking

Let's try another thing.. HOW the hell i make an multiple spell caster without that consume? accepting scripts :/



for _, data in ipairs(magia ) do
local c = Creature.GetByID(Self.TargetID())

im sure one of those locals is incrasing my ram