Exception when creating PDFDoc object using byte array for very large PDF's

Q: I’m getting an exception when I try to create a PDFDoc object
using a byte array using the following code. This occurs with PDF’s
with size > 500 MB.

FileStream fileStream = new FileStream(
                                    filename,
                                    FileMode.Open,
                                    FileAccess.Read);
BinaryReader reader = new BinaryReader(fileStream);
byte[] buffer = reader.ReadBytes((int)reader.BaseStream.Length);

// Validate PDF can be created as a PDFDoc (PDFTRON
Object)
PDFDoc pdfdoc = new PDFDoc(buffer, buffer.Length);

I can create the PDFDoc object fine if I use

‘pdfdoc = new PDFDoc(filename)’

But this is not what our application requires. I was just wondering if
this is a constraint or if there is something else I should be doing.
---------------------
A: It is possible that VM is running out of memory. In this case you
may want to check your VM settings for memory limits. Ideally PDF
would be accessed directly from disk (in this case PDFNet is only
loading the minimum required data so you should be able to efficiently
process files with several gigabytes). If you need to store all
documents in memory, than you may need to upgrade RAM and use the 64-
bit version of PDFNet (in order to be able to keep large quantiies of
data in RAM).