Forum > Database
"Data element too large"
eli:
--- Quote from: marcov on November 13, 2021, 10:41:51 pm ---Not really. But usually that means that a structure is over 2GB, and then it would be a good thing to rethink.
--- End quote ---
I noticed, that if I replace the arrays of records by arrays of pointers to records, the program is compiled well.
If I also turn off the {$mode objfpc} then also the NEW operation runs well. But I need this mode, because my program uses the unit gmp.
So it seems I have to give up...
wp:
If you cannot work around this huge data structure you must go to a 64-bit system: The following code works flawlessly on my 64-bit installation of Laz on Windows:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1; type n = 0..1849; sequence = array[1..13] of n; var ArrayOfRecords: array[1..8192] of record sq: sequence; ar: array[1..8192] of record s: sequence; x: integer end end;begin WriteLn(SizeOf(ArrayOfRecords) div (1024*1024),'MB'); ReadLn;end.
440bx:
--- Quote from: eli on November 15, 2021, 03:22:13 pm ---The result is "out of memory" (exitcode 217).
The same happens if I also repalce the other array of records by an array of pointers to records (but with another exitcode, 255, and without the message "out of memory").
--- End quote ---
It sounds like you're compiling the program for 32bit. That data structure is too large for a 32bit program running in a 2GB address space. It should be fine as a 64bit program (provided the O/S is configured properly.) A 32bit program _may_ be ok under some specific circumstances but, not the usual ones.
--- Quote from: eli on November 15, 2021, 03:22:13 pm ---However I noticed that the NEW operation does run well, if I turn off the {$mode objfpc}. But I need this mode, because my program uses the unit gmp.
--- End quote ---
Personally, for a structure that large, I'd use VirtualAlloc/Ex. I'd stay away from "sugar coated" memory blocks.
ETA:
pretty much what @marcov and @wp stated while I was typing my reply.
eli:
--- Quote from: 440bx on November 15, 2021, 03:45:39 pm ---It sounds like you're compiling the program for 32bit. That data structure is too large for a 32bit program running in a 2GB address space. It should be fine as a 64bit program (provided the O/S is configured properly.) A 32bit program _may_ be ok under some specific circumstances but, not the usual ones.
--- End quote ---
Actually, the system (Windows 7) in my (old) laptop is of 64-bit, but its RAM memory is 3G only...
--- Quote from: 440bx on November 15, 2021, 03:45:39 pm ---Personally, for a structure that large, I'd use VirtualAlloc/Ex. I'd stay away from "sugar coated" memory blocks.
--- End quote ---
Interesting. I was not aware of that. Do I have to write anything in my program (written in Free Pascal) for executing VirtualAlloc/Ex?
winni:
--- Quote from: eli on November 15, 2021, 05:21:18 pm ---
Actually, the system in my (old) laptop is of 64-bit, but its RAM memory is 3G only...
--- End quote ---
But - depending on your OS - you got a swapfile or a swappartition which ist larger that that.
Winni
Navigation
[0] Message Index
[#] Next page
[*] Previous page