6 Replies Latest reply on Oct 27, 2006 4:39 AM by 4lx

    Runtime Memory Problem

    4lx
      Hi,
      I'm importing some jpeg files during runtime. But after some images, like 30-40, the movie gets very large in memory so it stops running. I don't realy understand why. Why does all images have to preload into memory? Is there a propery that I have to set somewhere?
      Here is the code I'm using:
      aMember = new(#bitmap, castlib "Images")
      aMember.importFileInto(myFolder & "\" & myFile)
      -- set the regPoint of (member myMemberName of castlib "Images") to point(0 0)
      _movie.unLoadMember(_movie.member(myMemberName, "Images"))

      Please help me out here!
        • 1. Re: Runtime Memory Problem
          duckets Level 1
          not sure where your property 'myMemberName' is being set - you haven't specified it in your code. However this should suffice:

          aMember.unload()

          have a go!

          - Ben
          • 2. Runtime Memory Problem
            4lx Level 1
            I didn't think that was important but here's the code:
            myMemberName = char 1 to (length(myFile)-4) of myFile

            I already tried unload and that doesn't help. I replaced it with unloadMember because of that I change the regPoint in the image. And in Director Documentation it says about unload: Cast members that you have modified during authoring or by setting picture, pasteClipBoadInto(), and so on, cannot be unloaded. I'm not sure what that means, but it doesn't say anything about that with unLoadMember.

            9-10 years ago I did a pretty big production with Director were I had to preload and unload images all the time because of the size of the ram we had during that time. The casts we used could be filled with hundreds of bitmap images. The bitmaps where not loaded into memory until I preloaded them or displayed them in the score.

            But, let say like this: the jpeg images are like 100-400 kb when they are compressed. The resolution is 1280 x 760. Then, should 40 jpeg images be over 1 gig in ram without ever being displayed? That I don't understand. Should it not be better if Director loads the images into the cast (hard drive) and when displayed load it into ram?

            Anyway, now the exhibition is over and we used a computer with a lot of ram and virtual memory, and limited the images to 80 jpegs. But I still would like to know how I should solve this untill next time.
            • 3. Re: Runtime Memory Problem
              Mark_A_Boyd Level 1
              <Logging into Web Forum from link in newsgroup> Re: Extract Code from corrupt file

              Hey! You guys DO use sig files. Too bad they don't make it to the usenet server.

              quote:

              Originally posted by: 4lx

              Anyway, now the exhibition is over and we used a computer with a lot of ram and virtual memory, and limited the images to 80 jpegs. But I still would like to know how I should solve this untill next time.


              I didn't see any of your repeat code, but the basic idea ( as I understand the problem from the other thread) is to use the mod operator and saveMovie every so often.

              I have only used this concept in Authoring mode and I don't know how well or if it works in projector mode.

              The attached sample code, I presume, will appear beneath my typed message.

              <back to the speedy newsgroups>
              • 4. Re: Runtime Memory Problem
                Level 7
                On Fri, 27 Oct 2006 00:10:30 GMT, Mark A. Boyd posted in
                macromedia.director.lingo:

                > I have only used this concept in Authoring mode and I don't know how
                > well or if it works in projector mode.

                Of course, now that I think about it, in projector mode you cannot use
                saveMovie (ain't hindsight grand?).

                In a case like that, you would need to import into an external, unprotected
                castLib file and try 'save castLib' instead.

                Again, I have not tested this in projector mode.



                --
                Mark A. Boyd
                Keep-On-Learnin' :)
                • 5. Re: Runtime Memory Problem
                  Lukewig Level 1
                  Hi,

                  Do you need to import all the images at once? Or is it possible to only 'import' images as they are needed (giving Director more of a chance to do some member management). Also, try setting the filename of a placeholder member rather than importing.

                  -- Luke
                  • 6. Re: Runtime Memory Problem
                    4lx Level 1
                    Here is the repeat code with the sugestions I've got, and it still doesn't work
                    The castlib doesn't get saved.

                    repeat with i = 1 to 200
                    myFile = getNthFileNameInFolder(myFolder, i)
                    if myFile = EMPTY then exit repeat
                    myMemberName = char 1 to (length(myFile)-4) of myFile
                    aMember = new(#bitmap, castlib "Images")
                    aMember.importFileInto(myFolder & "\" & myFile)
                    set the regPoint of (member myMemberName of castlib "Images") to point(0 0)
                    -- _movie.unLoadMember(_movie.member(myMemberName, "Images"))
                    -- aMember.unload()
                    if i mod 20 then
                    save castLib "Images"
                    end if
                    images.append(myMemberName)
                    end repeat

                    I'm loading images from a USB-memory. The thing is that I want to be able to take that out and fill it with new images from another computer so I don't have to stop the projector. That's why I need to read all images at once.