There is a task: measure the time for performing different operations with different collections with different data types.

Collection class code:

public class LinkedQueueLarge { LinkedList<LargeData> _LinkedList = new LinkedList<LargeData>(); public void Add(LargeData data) { _LinkedList.AddLast(data); } public LargeData Rem() { LargeData data = _LinkedList.First(); _LinkedList.RemoveFirst(); return data; } } 

Data for filling:

 unsafe public struct LargeData { public fixed byte a[102400]; } 

And the code during the execution of which the error occurs:

 float lql1 = 0, LinkedQueueLarge LQL = new LinkedQueueLarge(); textBox1.Text += "LinkedQueue, Large Data\n"; for (int i = 0; i < 2500; i++) { int StartTime; int ResultTime; StartTime = Environment.TickCount; LQL.Add(new LargeData()); ResultTime = Environment.TickCount - StartTime; lql1 += ResultTime; } 

The error itself:

System.InvalidProgramException: "The JIT compiler has detected an internal constraint."

And also in LQL._linkedList.Message (what is it all about?) In debugging when stopping due to an error value:

It is impossible to create an array of type "LargeData" from the assembly "lab07, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null" because the base type of the value is too large.

  • 6
    Do you consciously use a fixed-size, insecure buffer? If, for example, just make a public struct LargeData { public byte[] a; } public struct LargeData { public byte[] a; } and call as LQL.Add(new LargeData { a = new byte[102400] }); then there will be no such problems. - Regent
  • In the instructions for the implementation of the labs it was written. Until the end, the meaning of the original design does not catch. Thank you, it works that way. - PFFFIZI
  • There is, for example, a small article in the documentation about this. At some basic points, it can shed light. - Regent

0