I also noted that the problem recurs when passing negative values ββto the length of the vector. A possible explanation is that the vector is trying to isolate the length that it gave immediately.
Since a negative value is forced into uint, a negative value is automatically converted to a very large positive value. this causes Vector to try to allocate too much memory (about 4 GB) and therefore an immediate crash.
if you pass a negative value to the length of the array, nothing happens because, apparently, it is not trying to allocate the length. but you can check the value and see that it is a very large positive number.
This interpretation is a pure hypothesis; I have not heard anything. but this is consistent with the semantics and meaning of the exclamation mark.
This suggests that I was looking for our entire code base to use the "length" of the setter and could not find it with a vector. However, we very often encounter such accidents - some of them are caused by actual high memory consumption (possibly leaks), but in other cases this happens when the memory is relatively low.
I can not explain it. perhaps there are other operations that could potentially lead to the distribution of large amounts of memory, besides the setter being "length"?
source share