|
|
вернуться в форумОбщий форумMEMORY LIMIT Help!!! In problem 'Superlong Sums', i create program. It work correctly, haven't 1000K of memory. I posted program. Result was: 'Memory Limit Exceeded: 1398 K usage'... At this moment, i create test account and posted program: program test; begin end. Result is: '389 K usage'. _______________________________________ Second program: program test; var arr:array[1..512000] of integer; begin end. Result is: '389 K usage'. ________________________________________ Third program: program test; var arr:array[1..512000] of integer; i:longint; begin for i:=1 to 512000 do arr[i]:=1; end. Result is: '2363 K usage'. _________________________________________ I can't understand, what is happened? Re: MEMORY LIMIT This problem arise only in Pascal programs, IMHO: in ALL programs on Pascal, memory usage>=389 K. On C++, memory usage can be 0. For example: #include<math.h> int main() { int i; int myarr[512001]; i=1; while(i<512000) { myarr[i]=64000; i++; }; } Memory usage is EIGHT KILOBYTE!!! __________________________________ Second example: #include<math.h> int main() { int i; long int myarr[512001]; i=1; while(i<512000) { myarr[i]=i; i++; }; } Memory usage is 1016 KB, This is right... :-((((((((((((((((((((((((((((((((((((( |
|
|