My proposal is that if set would declare variable over 5MB (example size, may vary) in size, the fish shell would make a warning. It could be ignored by redirecting STDERR (or by specifying a flag for set, but provide a way to ignore this warning in case the user really means this). This is just an example, and I'm sure it could be cleaner.
$ set variable (over5mb)
fish: Variable $variable is assigned with a huge value. This is most likely is a bug.
set variable (over5mb)
This might have helped with diagnosing #842 #1038 and #1079 (as long as the warning is printed in batch mode).