Although, "well, then don't do that!" is NEVER a good way to diagnose issues like this, you should still consider looking into a more elegant solution than breaking an inventory that has tons of items in it.
For the record, if you did this in 3.1.1 and then walked into the pile of items that...