top | item 40333736

(no title)

jbosh | 1 year ago

So scary. I was working on a garbage collection bug for a AAA video game one time for months. It'd crash once a day on a tester machine and we'd add more and more prints to try and narrow it down.

Finally got enough information and realized that the padding of a specific object was wrong (GC expected 16 bytes, object was 12 bytes). This caused dozens of other corruption bugs to disappear that we didn't even think were GC related.

discuss

order

stingraycharles|1 year ago

How is that possible? Which language was this in?

rwmj|1 year ago

I don't know, but we had a similar bug in OCaml, although in reverse.

Linux/x86-64 expects the stack to always be 16 byte aligned (although the ABI documentation at the time didn't make this assumption very clear). OCaml called into C with a non-aligned stack. GCC-generated code, assuming the stack was 16 byte aligned, used some strange Intel AVX instruction that only works on aligned data, unlike every other Intel instruction ever that can work on any alignment (albeit maybe more slowly).

This manifested itself as rare and totally unreproducible crashes (because stack alignment differed between runs). It was a bit of a nightmare to solve.

jbosh|1 year ago

C++, it was an in house engine to make everything fit in memory on PS3. Removing fragmentation gave ~10% of usable memory back.

taspeotis|1 year ago

AAA game is likely C++

packetlost|1 year ago

Probably a custom one built for an in-house engine in C++ if it's a AAA studio. Alternatively one of the various off-the-shell ones you can #include, though my money is on the former. Note: I am not GP, I'm making educated guesses about what may have happened :)

npalli|1 year ago

GC and AAA probably C#.