As a stop-gap solution, I propose to increase this limit to at least 1000000.
In the future, numlib should be converted to dynamic arrays,
so this limit will disappear entirely.
This is not possible, since it goes for matrix in both ways. So the upper limit of numlib memory allocation is O(highestelement^2), not O(highestelement).
You probably didn't notice since you only used vector functions, and not matrix ones. Still it could be possible that this isn't always automatically allocated, that will need checking.
----
You are absolutely right this should be rearchitected in time, like many libraries could use some attention. (we also still don't have a MPI library)
It seems to be a good student task, but students seem to think implementing compiler features is more sexy ( :-) )
I am adding a patch which extends the hard-coded array size up to the limit of the data types while leaving the basic array/matrix addressing idea in numlib untouched.
The patch also declares ArbInt as integer instead of longint (which is too small nowadays).
You were right if these constructs would allocate memory. I think they don't. The "absolute" directive just maps a data type over another already allocated variable. In my opinion it is the same as a typecast:
u := arfloat1(u1)
If it would allocate memory any call to one of these procedures would die with a stack overflow error because the stack is usually less than 4GB.
I ran this test:
programproject1;usestyp;typemyarbfloat1=array[1..High(ArbInt)divsizeof(ArbFloat)]ofArbFloat;procedureRunTest(vara:ArbFloat;n:Integer);varva:myarbfloat1absolutea;beginWriteLn(va[1]);ReadLn;// <--- wait to look at the task managerend;consta:array[1..10]ofArbFloat=(1,2,3,4,5,6,7,8,9,10);beginRunTest(a[1],10);end.
It does not crash. And looking at memory usage in the Windows TaskManager shows no memory increase when the process stops at the ReadLn.
Of course, there's a risk that writing to u will write over the limits of the memory allocated by u1. But the other way of accessing the array element by pointers (^arbfloat) has the same issue.