Author Topic: help resolving 'Out of memory' Error  (Read 79 times)

Offline Sam.

  • The moose man
  • Planewalker
  • *****
  • Posts: 67
  • Gender: Male
    • Classic Adventures Homepage
help resolving 'Out of memory' Error
« 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
"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"
-- <CHARNAME> to Portalbendarwinden

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 897
Re: help resolving 'Out of memory' Error
« Reply #1 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.

Offline Sam.

  • The moose man
  • Planewalker
  • *****
  • Posts: 67
  • Gender: Male
    • Classic Adventures Homepage
Re: help resolving 'Out of memory' Error
« Reply #2 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...
"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"
-- <CHARNAME> to Portalbendarwinden

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: