by Accensus » Thu Sep 08, 2022 4:21 am
This has been tested on both 4.8.2 and GZDoom g4.9pre-214-gba83879e9 by both me and several people. Disclaimer: I am not 100% sure it's a GC issue.
I don't really have a simple test because it's a really specific problem that requires me to post the full mod (earliest I can do is tomorrow), if that'd even be remotely helpful for this. No steps to reproduce because there is no way to reproduce this on the user end in the first place, and that's the painful part. I've been chasing this issue for over four weeks now and it happens completely randomly during gameplay. Any attempts to forcefully reproduce it have been futile. Some people have had it within 30 minutes of starting the game, meanwhile I'm five hours and counting into Extermination Day with no null ref exception in sight.
The gist of it is that mod inventory items that are about to be picked up have an array with data (objects of type ItemData) which is transferred to the array of the item already in your inventory through HandlePickup. Problem: Array.Append copies the references (I cannot use Array.Move). The object that just got picked up gets destroyed immediately afterwards. The data objects that got appended remain in the new array until a random amount of time later when the GC presumably decides to nuke them for no reason, usually either immediately on pickup or several (or many) seconds afterwards. I know for a fact this isn't my code doing that because nowhere in it do I even call Destroy() on ItemData objects, especially in such a random manner, nor do I set core data array elements to null without shrinking the array at the same time, which leaves only GZDoom. Not to mention it doesn't always happen even on the exact same objects in the exact same scenario after, say, loading a save game. There is absolutely no way to predict when it will happen.
This has been tested on both 4.8.2 and GZDoom g4.9pre-214-gba83879e9 by both me and several people. Disclaimer: I am not 100% sure it's a GC issue.
I don't really have a simple test because it's a really specific problem that requires me to post the full mod (earliest I can do is tomorrow), if that'd even be remotely helpful for this. No steps to reproduce because there is no way to reproduce this on the user end in the first place, and that's the painful part. I've been chasing this issue for over four weeks now and it happens completely randomly during gameplay. Any attempts to forcefully reproduce it have been futile. Some people have had it within 30 minutes of starting the game, meanwhile I'm five hours and counting into Extermination Day with no null ref exception in sight.
The gist of it is that mod inventory items that are about to be picked up have an array with data (objects of type ItemData) which is transferred to the array of the item already in your inventory through HandlePickup. Problem: Array.Append copies the references (I cannot use Array.Move). The object that just got picked up gets destroyed immediately afterwards. The data objects that got appended remain in the new array until a random amount of time later when the GC presumably decides to nuke them for no reason, usually either immediately on pickup or several (or many) seconds afterwards. I know for a fact this isn't my code doing that because nowhere in it do I even call Destroy() on ItemData objects, especially in such a random manner, nor do I set core data array elements to null without shrinking the array at the same time, which leaves only GZDoom. Not to mention it doesn't always happen even on the exact same objects in the exact same scenario after, say, loading a save game. There is absolutely [i]no[/i] way to predict when it will happen.