Memory Leaking Encounters, and Web Admin
Hey Folks! More memory leak patching today. I think I've finally got most of yesterday's leaks sorted out, including the encounters.
I ended up having to postpone the encounter item disposal until a bit later in the turn update code, as there is a point at which discharges and player item removal is finished and new encounter choices are populated. This is where I had to not only clear out old temp items, but also shield any in-game items linked to the temp items so they didn't get discarded out from under the player. Was a bit tricky to figure out, but seems to be working now.
Tiago alerted me to an issue with my item definition fix yesterday, in that he's "lazy loading" them to minimize memory usage and load times. As a result, I had to do a bit more scaffolding around the way item defs are loaded and destroyed to make sure the minimum necessary amount were in memory at any time. Basically, each item def now keeps track of how many items refer to it, and it only gets destroyed if that count goes to 0.
Also, I had to ignore this destroy() call on a few special item types, where all item defs are shared. E.g. newspapers, data files, recipe hints, campsites, etc.
With that out of the way, I'm now looking into hardware and software. It seems these are some of the only remaining items not released from memory when ending a game, for some reason. The hardware that contains software and batteries goes away, but not the contents. And I can't see any reason why this is so. But, I just started this task late in the day, so maybe tomorrow I'll have more luck.
In other news, a chunk of my day was wasted fighting a botnet. This time, it seems like it was trying to brute force its way into user accounts by trying a list of usernames and passwords. And when I figured out how to block that botnet, either it changed tack or another botnet coincidentally started. This time very specifically trying to access any admin-like username it could. So I blocked that, too. I think one or both are still running, as they show up in my logs. But thankfully, they're not doing much with the blocks in place.
Still, it's annoying. And kind of confusing. I should maybe put up a sign somewhere like those "no cash in vault" stickers at convenience stores. This site has literally so little of value to a hacker, I'm not sure why it'd be worth the effort.
Unless they really don't want NEO Scavenger mobile to come out soon? That must be it. They're making me pay for their lost productivity in advance :)