Maybe I should have known this already but I didn't or have forgotten.
If you don't assign an UDT item an initial value it could start with anything. I just found and fixed a problem where I assumed an integer item would start at 0 if not assigned. It does not behave like normal variables that haven't been assigned initial values. You can't assume an unassigned integer item of UDT will be at 0.
To be more specific I found the problem in Dynamic array of UDTs where the first one in the array did seem to be consistently starting at 0 and I was REDIM _PRESERVE expansions of the UDT array.
MEM works the same way with _MEMNEW — it just allocates an area of memory for your needs, without initiating it to zero/null. This can save a good bit of processing time, (After all, why take the time and effort put blank data in your fields, if you’re just going to put another set of information into it right afterwards?), but it
can cause you issues if you’re expecting to read the data before writing to it (such as how you were doing and assuming it’d default to zero).
Solution is, of course, as you presented it: Make certain to fill that memory with 0 before using it. (_MEMFILL is an excellent tool for this job.)