Difference between revisions of "Talk:NPC Lag Compensation"

From Valve Developer Community
Jump to: navigation, search
Line 10: Line 10:
 
I don't feel I have sufficient information on the cause of the leak to modify this article, and the solution I described isn't ideal, but I figured I'd at least leave a note for people who run into a similar problem.
 
I don't feel I have sufficient information on the cause of the leak to modify this article, and the solution I described isn't ideal, but I figured I'd at least leave a note for people who run into a similar problem.
 
--[[User:TheGreenBunny|theGreenBunny]] 01:12, 13 Dec 2008 (PST)
 
--[[User:TheGreenBunny|theGreenBunny]] 01:12, 13 Dec 2008 (PST)
 +
 +
:Aha, I was experiencing a significant leak too, but I'd never suspected this code. Eitehr what you describe, or perhaps some of the Purge calls need to be changed to PurgeAndDeleteContents. I hope to be able to get back to this sometime in the next few weeks. --[[User:Winston|Winston]] 12:55, 20 Dec 2008 (PST)

Revision as of 20:55, 20 December 2008

I appreciate that this article is messily laid out ... help on that front would be appreciated! Rather than large code blocks, I had initially used the form "select this whole function and find & replace in selection Player, replacing with Entity" ... this got very confusing. --Winston 16:40, 11 Apr 2008 (PDT)



We used this code for Zombie Master, and it appears to contain a memory leak (at the time of writing). I solved it by moving the NPC's lag compensation data (ie. its linked list of LagRecords etc) into BaseNPC. Not very pretty, but it stops leaking memory. I'd theorize that the switching around of tracks performed in UpdateAIIndexes() may be losing track of memory somehow, perhaps only in certain edge cases where many NPCs die. Whatever the cause, having each NPC hold its own lagcompensation data simplifies things a lot and prevents the leak from occurring.

I don't feel I have sufficient information on the cause of the leak to modify this article, and the solution I described isn't ideal, but I figured I'd at least leave a note for people who run into a similar problem. --theGreenBunny 01:12, 13 Dec 2008 (PST)

Aha, I was experiencing a significant leak too, but I'd never suspected this code. Eitehr what you describe, or perhaps some of the Purge calls need to be changed to PurgeAndDeleteContents. I hope to be able to get back to this sometime in the next few weeks. --Winston 12:55, 20 Dec 2008 (PST)