Programming in C# — Question 71
You are debugging a 64-bit C# application.
Users report System.OutOfMemoryException exceptions. The system is attempting to use arrays larger than 2 GB in size.
You need to ensure that the application can use arrays larger than 2 GB.
What should you do?
Answer options
- A. Add the /3GB switch to the boot.ini file for the operating system.
- B. Set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag in the image header for the application executable file.
- C. Set the value of the gcAllowVeryLargeObjects property to true in the application configuration file.
- D. Set the value of the user-mode virtual address space setting for the operating system to MAX.
Correct answer: C
Explanation
The correct answer is C because setting the gcAllowVeryLargeObjects property to true allows the application to allocate arrays larger than 2 GB. Option A is incorrect as the /3GB switch is not applicable for 64-bit applications. Option B, while related to large address awareness, is not the correct solution for this specific scenario. Option D does not directly address the application's configuration for large arrays.