Pocket Plane Group

Friends and Neighbors => Weimer Republic (WeiDU.org) => WeiDU => Topic started by: Sam. on October 20, 2017, 12:54:28 PM

Title: help resolving 'Out of memory' Error
Post by: Sam. on October 20, 2017, 12:54:28 PM
The following code gives me the dreaded "Out of memory" error (I'm running it on SoD), but I don't understand why.  The variables used should be overwritten with new values on each loop, and just to test I have tried purposefully shrinking the only significantly sized variable ("contents") used.  I still get the out of memory error.  Note that from a system hardware standpoint, I could store the entirety of SoD AND the Documents folder in memory and still not run out.  What am I doing wrong?

Code: [Select]
//! Test RLEColorIndex //////////////////////////////////////////
BEGIN ~Test RLEColorIndex~
NO_LOG_RECORD

  COPY_EXISTING_REGEXP GLOB ~.*.bam~ ~override~
    READ_ASCII 0x0 sg (4)    // Signature
    READ_ASCII 0x0 sn (3)    // Short signature
PATCH_IF (~%sg%~ STRING_EQUAL_CASE ~BAMC~ = 1) BEGIN // Decompress if needed.
      READ_LONG 0x8 dl                // Uncompressed data length
      DECOMPRESS_INTO_VAR 0xc (SOURCE_SIZE - 0xc) dl contents
    END ELSE BEGIN
      dl = SOURCE_SIZE                // Uncompressed data length
      READ_ASCII 0 contents (dl)
    END
INNER_PATCH_SAVE contents "%contents%" BEGIN
  PATCH_IF (~%sn%~ STRING_EQUAL_CASE ~BAM~ = 1) BEGIN
    READ_BYTE 0x0b RLEColorIndex // RLEColorIndex
    PATCH_IF (RLEColorIndex != 0) BEGIN
      PATCH_PRINT ~%SOURCE_FILE% RLEColorIndex = %RLEColorIndex%~
    END
  END
      DELETE_BYTES 0x0 dl
END
SPRINT contents ~~
  BUT_ONLY
Title: Re: help resolving 'Out of memory' Error
Post by: Wisp on October 20, 2017, 01:46:21 PM
You can be fairly confident this has little to nothing to do with your machine and is instead about some implementation specifics in WeiDU or maybe OCaml. The exception is not just about memory. OCaml also raises it when it runs out of other things (stack space, for instance). I don' have SoD and can't reproduce this and OCaml exceptions could not be more useless, so I'll have to ask you to please narrow the problem down further.
Title: Re: help resolving 'Out of memory' Error
Post by: Sam. on October 20, 2017, 02:15:00 PM
Huh, I guess this isn't the same out of memory error I thought it was.  The z-lib compressed MNEOG1.BAM decompresses into 18,179,007 bytes which i guess exceeds WeiDU's file size limit...