The Undefeated Posted May 26, 2017 Posted May 26, 2017 There's a memory leak in this script, but can't find it. boolean isSplashing; long magicxp; private Predicate<NPC> suitableNPC = n -> getMap().canReach(n) && n.getHealthPercent() > 0 && n.hasAction("Attack") && !n.isUnderAttack() && getMap().realDistance(n) < 15; public int onLoop() throws InterruptedException { isSplashing = true; magicxp = getSkills().getExperience(Skill.MAGIC); sleep(random(3600,4800)); if (magicxp == getSkills().getExperience(Skill.MAGIC)) { isSplashing = false; } if (!myPlayer().isUnderAttack() || !isSplashing) { if (getInventory().contains("Air rune") && getInventory().contains("Mind rune") && getInventory().contains("Fire rune")) { java.util.List<NPC> npcs = getNpcs().getAll().stream().filter(suitableNPC).collect(Collectors.toList()); if (!npcs.isEmpty()) { npcs.sort(Comparator.<NPC>comparingInt(a -> getMap().realDistance(a)).thenComparingInt(b -> getMap().realDistance(b))); if (npcs.get(0).interact("Attack")) { sleep(random(3000)); } } sleep(random(3000,4000)); } else { stop(); } } return random(300,400); } Threw some stuff around to see if something changed. In like 4-5 hours the memory usage went from 600MB to 1.2GB.
Deceiver Posted May 26, 2017 Posted May 26, 2017 why do you have complex checks for splashing if all you really need is check closest npc check if not interacting autocast splash spell type in clan chat 3-5 mins might be the checks idk for sure
Fearsy Posted May 26, 2017 Posted May 26, 2017 Im having the same issue using a script @Shudsy made for me. I thought it was the script aswell but it could be a client issue if more than a few people are having this problem
Shudsy Posted May 26, 2017 Posted May 26, 2017 39 minutes ago, toogsi said: Im having the same issue using a script @Shudsy made for me. I thought it was the script aswell but it could be a client issue if more than a few people are having this problem Your script had a massive CPU usage because you got a NPE.
The Undefeated Posted May 26, 2017 Author Posted May 26, 2017 1 hour ago, raijin said: why do you have complex checks for splashing if all you really need is check closest npc check if not interacting autocast splash spell type in clan chat 3-5 mins might be the checks idk for sure What is complex in your eyes?
Deceiver Posted May 26, 2017 Posted May 26, 2017 1 minute ago, The Undefeated said: What is complex in your eyes? nothing really just dont think you need a list for 1 target private Predicate<NPC> suitableNPC = n -> getMap().canReach(n) && n.getHealthPercent() > 0 && n.hasAction("Attack") && !n.isUnderAttack() && getMap().realDistance(n) < 15; java.util.List<NPC> npcs = getNpcs().getAll().stream().filter(suitableNPC).collect(Collectors.toList()); if (!npcs.isEmpty()) { npcs.sort(Comparator.<NPC>comparingInt(a -> getMap().realDistance(a)).thenComparingInt(b -> getMap().realDistance(b)));
The Undefeated Posted May 26, 2017 Author Posted May 26, 2017 (edited) 4 minutes ago, raijin said: nothing really just dont think you need a list for 1 target private Predicate<NPC> suitableNPC = n -> getMap().canReach(n) && n.getHealthPercent() > 0 && n.hasAction("Attack") && !n.isUnderAttack() && getMap().realDistance(n) < 15; java.util.List<NPC> npcs = getNpcs().getAll().stream().filter(suitableNPC).collect(Collectors.toList()); if (!npcs.isEmpty()) { npcs.sort(Comparator.<NPC>comparingInt(a -> getMap().realDistance(a)).thenComparingInt(b -> getMap().realDistance(b))); Oh yeah, copied it from Macro killer, just because I was that lazy. But still doesn't fix the memory leak.. Edited May 26, 2017 by The Undefeated
The Undefeated Posted May 26, 2017 Author Posted May 26, 2017 Thanks to @Bamboozled for solving my problem. I had no sound drivers installed on my server, turned off the sound and it was fixed. 1
Phaibooty Posted May 27, 2017 Posted May 27, 2017 6 hours ago, The Undefeated said: Thanks to @Bamboozled for solving my problem. I had no sound drivers installed on my server, turned off the sound and it was fixed. wtf LOL. Was it really fucking sound drivers LOL.
dmmslaver Posted May 27, 2017 Posted May 27, 2017 Just now, Phaibooty said: wtf LOL. Was it really fucking sound drivers LOL. I mean i can just see tens of thousands of error logs piling up in memory from rs constantly sending sounds