Forum > Database

"Data element too large"

(1/6) > >>

eli:
Compling the following program, I receive the message: "Data element too large".

Are there any tricks to overcome the problem, without splitting the arrays/records?


--- 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";}};} ---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                                    endbegin end.

marcov:
Not really. But usually that means that a structure is over 2GB, and then it would be a good thing to rethink.

440bx:

--- Quote from: eli on November 13, 2021, 10:39:59 pm ---Are there any tricks to overcome the problem, without splitting the arrays/records?

--- End quote ---
The simplest workaround is to define a separate record for the inner record and have the ArrayOfRecords simply be an array of pointers to those records. 

The only additional work that causes is, the program has to allocate memory for the inner records (in Windows, using VirtualAlloc(Ex) would be the preferable method though, even HeapAlloc could do it.)

There is one gotcha though, that data structure is large enough that there may not be enough contiguous virtual space available in a 32 bit process to accommodate it but, it wouldn't be a problem for a 64 bit program.

HTH.

eli:

--- Quote from: 440bx on November 14, 2021, 01:04:04 am ---The simplest workaround is to define a separate record for the inner record and have the ArrayOfRecords simply be an array of pointers to those records.
--- End quote ---
Unfortunately, your advice doesn't help when I try to use the NEW operation for starting those pointers. 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").

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.

So it seems I have to give up... 

marcov:
ArrayOfRecords is  +/- 2 billion bytes (8192*8192 * (4+13*2)). That is simply too much for 32-bit apps for all practical purposes.

If it is only this one array, allocate it immediately after startup.

Navigation

[0] Message Index

[#] Next page

Go to full version