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?
//! 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