https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/100175&feed=atom&action=history
Microsoft KB Archive/100175 - Revision history
2021-01-16T00:13:38Z
Revision history for this page on the wiki
MediaWiki 1.34.2
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/100175&diff=45881&oldid=prev
3155ffGd: importing KB archive
2020-07-18T15:01:51Z
<p>importing KB archive</p>
<p><b>New page</b></p><div>{|<br />
|width="100%"|<br />
== ACC1x: GP Fault When Allocating Huge Arrays ==<br />
|}<br />
<br />
Q100175<br />
<br />
<br />
-----<br />
<br />
The information in this article applies to:<br /><br />
<br />
<br />
* Microsoft Access versions 1.0, 1.1<br />
<br />
<br />
-----<br />
<br />
<br /><br />
<br />
<br />
== SYMPTOMS ==<br />
<br />
When you try to allocate a huge array, you may receive a general protection (GP) fault. The following error message appears:<br /><br />
<br />
<br />
<blockquote><div class="ERRORMESSAGE"><br />
<br />
An error has occurred in your application. If you choose Ignore, you should save your work in a new file. If you choose Close, your application will terminate.<br />
<br />
</div></blockquote><br />
<br /><br />
<br />
<br />
== CAUSE ==<br />
<br />
If you have allocated an array element that includes a string or variant data type and the size of the array exceeds 64K, you may receive the error message described above, if the following criteria are met:<br /><br />
<br />
<br />
* The array must be huge and span two or more data segments.<br />
* Each array element must contain at least one dynamic string or variant.<br />
* The number and size of the array elements must cause the last segment of data to be exactly the same size as the first segment of data.<br />
<br />
<br /><br />
<br />
<br />
== RESOLUTION ==<br />
<br />
Declare the array so that the last data segment contains a different number of elements from the first data segment.<br />
<br />
<br /><br />
<br />
<br />
== STATUS ==<br />
<br />
Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.<br />
<br />
<br /><br />
<br />
<br />
== MORE INFORMATION ==<br />
<br />
Access Basic has the ability to define huge arrays, larger than the normal 64K data segment. Any element or index of a huge array may not extend across the 64K-segment boundary. If all elements of the array cannot be allocated within the 64K segment, only the elements of the array that fit evenly in the segment are allocated. Microsoft Access then allocates another 64K segment to the array and continues to fill the new segment with the remaining elements.<br /><br />
<br /><br />
If the size of the data type defined in the array is a power of 2, the 64K segment is completely full. If the size is not a power of 2, the segment contains wasted space, since Microsoft Access cannot place a portion of one element in one segment and the rest of that element in the next segment.<br />
<br />
=== Example ===<br />
<br />
<pre class="FIXEDTEXT"> Type Foosball<br />
<br />
A(3000) As double<br />
d As String<br />
<br />
End Type </pre><br />
<br /><br />
The size of this structure is 24,012 bytes (3000 * 8 bytes/double + 12 bytes/string). If you declare this array with three elements, you have two data segments, as follows:<br /><br />
<br />
<br />
<pre class="FIXEDTEXT"> Data Segment #1 Data Segment #2<br />
----------------- -----------------<br />
Free space 17512 Free space 41524<br />
Array(1) 24012 Array(3) 24012<br />
Array(2) 24012 </pre><br />
<br /><br />
In Microsoft Access, you may receive a GP fault if the number of elements in the first segment is equal to the number of elements in the last segment and the data structure used to define the array is made up of either a string or variant data type. If you define the data structure above with six elements, your memory map looks like the following:<br /><br />
<br />
<br />
<pre class="FIXEDTEXT"> Data Segment #1 Data Segment #2 Data Segment #3<br />
----------------- ----------------- -----------------<br />
Free space 17512 Free space 17512 Free space 17512<br />
Array(1) 24012 Array(3) 24012 Array(5) 24012<br />
Array(2) 24012 Array(4) 24012 Array(6) 24012 </pre><br />
<br /><br />
The actual dimension statement looks like the following:<br /><br />
<br />
<br />
<pre class="CODESAMP"> Function Sample()<br />
Redim Array(6) As Foosball<br />
End Function </pre><br />
<br /><br />
To work around this problem, declare the array so that the last data segment does not contain the same number of elements as the first data segment. In addition to the example above, you may choose to define the array with seven elements instead of six. This causes Microsoft Access to allocate four data segments, in which the first data segment contains two elements of the array and the last data segment contains only one element.<br /><br />
<br /><br />
This example is very easy to duplicate with large data structures, but is more difficult to duplicate with smaller data structures. With an element size of 24,012 bytes, 4, 6, or 8 elements may cause a problem. With a data size of 1K, numbers of elements that duplicate this problem are 128, 192, 256, and so forth.<br />
<br />
Additional query words: GP fault GPF array<br />
<br />
Keywords : kbprg<br /><br />
Issue type : kbbug<br /><br />
Technology :<br />
<br />
{|<br />
|width="100%"| <br /><br />
Last Reviewed: November 4, 2000<br /><br />
<span>© 2001 Microsoft Corporation. All rights reserved. Terms of Use.</span><br /><br />
|}</div>
3155ffGd