electricalbah
electricalbah

Reputation: 2297

Extracting ISO files in 7z.dll- Out of Memory Exception

I have used two wrappers now to try to extract an ISO file. But no success

I have tried sevenzipsharp and C-NET-Interface-for-7-Zip-Archive-DLLs But they both give this same Exception. The ISO file contains .vob files(movies) and the total size of the ISO file is 4.35GB. When I try to extract a single .vob file of 1GB from it, I get Out of Memory Exception.

I actually want to extract the .vob files and then stream them over Upnp/DLNA

    SevenZipExtractor Extractor;
    try
      {
         String[] FileNames = RawFileExtractor(path, out Extractor);
         Extractor.ExtractFile(FileNames[8], ms) //the 1GB file: exception is here
      }
    catch{}
    Extractor.Dispose();

Upvotes: 0

Views: 1464

Answers (1)

Hans Passant
Hans Passant

Reputation: 942247

     Extractor.ExtractFile(FileNames[8], ms)

Can't see "ms" but it is guessable at a MemoryStream. That indeed is not going to work so well with a jiggabyte file. Very likely to get an OutOfMemoryException when your program runs as a 32-bit process. Easy enough to fix on your machine, you've to the horsepower. Project + Properties, Build tab, select AnyCPU and untick "Prefer 32-bit" if you see it.

Still very wasteful and not exactly guaranteed to work on your user's machine if he doesn't have a 64-bit operating system. Pretty unclear what you are actually doing with that MemoryStream, high odds that you should use a FileStream instead so it is directly extracted to the disk. You'll use 4096 bytes instead of a jiggabyte. A video player doesn't care if it plays from memory or the disk. Also review the wisdom of compressing video, it is already compressed by the encoder.

Upvotes: 0

Related Questions