Silvio a Beccara wrote:
That's no memory allocation error, but a range-check error. The computed size (next would be 130 * 255 * 255 * 255) doesn't fit in a 32 bit signed integer anymore. If you want to allocate more than 2 GB in a single allocation (which was not your original request), you could try to use an unsigned type (Cardinal or perhaps better SizeType). However, I've never tested this, so there may be RTS or libc issues.
what does in this context mean "range check error"?
The same as in other contexts: A value is out of range. 130 * 255 * 255 * 255 is bigger than what a 32 bit signed integer can hold (2^31 - 1).
Sometimes I get the same error when using dynamic arrays, usually when bounds are trespassed. Is there a way to know at which code line the error generates,
addr2line and run-gpc (you can search the archives for details).
and does the error have consequences on the results of the code?
Sure, it aborts. ;-)
If you disable range-checking, you get undefined behaviour. This can be anything from apparently correct operation, to minor or not so minor errors (wrap-around), to serious errors (memory trashing), to segfaults ...
Frank