You are here

AI Item Memory Leak, and Payroll Taxes

Hey Folks! More memory leak fixing today, plus a bit of fun (not) tax research.

The memory leak had me pretty defeated yesterday. Almost half a day of tracing output and trying experiments, and I still couldn't figure out where these orphaned items were coming from. I had a suspicion they were AI related, but couldn't prove it.

Fast forward one night's sleep, and I was finally able to make progress. Yay sleep!

It turns out AI was abandoning certain items if it could not TakeItem or DropItem, especially during spawning when they had no CurrentHex yet. The result was these items being instantiated then orphaned and stuck in memory even after quitting to main menu.

The code now checks for failed take/drop in some key places, and will destroy the ItemInstance in question. So far, this seems to reduce a significant number of orphaned ItemInstances resulting from AICreatures. (Typically, sticks, bottles, rags, and other low-value things.)

In fact, the ItemInstance debug report I made for listing orphaned items on the main menu seems to be 0 for three consecutive tests! They're short tests, to be fair. But that's a big drop from previous testing! Tiago's going to try testing some more tonight, and see if we're in the clear or not.

In less exciting news, with the end of the year fast approaching, I need to figure out how to pay myself. Now that I run an LLC (with S-Corp election), the way I pay myself has changed a bit from the old Sole Proprietorship I used to have. Namely, I need to pay myself wages, withhold the correct amount in taxes, and report/remit all that to the IRS. And that means setting-up some forms and processes that weren't there before.

So far, I've been putting that off because, well, because I hate learning new tax stuff. And I'm afraid of doing it wrong. I've already paid for consulting with accountants, so I think I know how to proceed. But the first time for a new business/tax thing is always annoying and rocky. Ugh.

Anyway, I've done some research, and I'll chew on that tonight. I think I know what I have to do and what forms to file. For now, time to have a beer and relax!