The problem doesn't involve the actual code itself but I think I overused list.
Problem description:
I know I read somewhere I while ago that lists can be overused and I might have done this.
Does mob/var/list/spelllist = new() create a new list for all NPCs, even those that have not been used yet? For example monsters are only generated for individual battles and then deleted at the end of the battle. I also assigned lists to turfs, maybe that was a bad idea if each turf in the game is using up 3 lists and I have a decent size map.
So are NPCs only using spelllist lists when var/mob/N=new M, M being anything from my set of monsters. mob/monster/magidrakee for example.