Can someone help me figure out this problem please. I have this variable byte drive_image = new byte[size] that I am using as part of a test sequence inside of my application. The application tests USB thumbdrives before we ship them out the door to the customer, and I need to figure this out pronto!! [size] is the actual size of the thumbdrive, so as you can imagine it could be 2GB or more. Sorry I can't be more specific about the test details (like why would I want to do this??).
What I need to know is how can I try to create this variable, and if it throws an out of memory exception, how can I retry with the size/2 until it can find a large enough contiguous block of memory? Any help would be greatly appreciated!