Loading ...
Sorry, an error occurred while loading the content.

HELP! Memory Leak

Expand Messages
  • seinolf
    Hey guys: i am new to flash, especially actionscript 3. I have some code that everytime it is run creates more memory. Please tell me what is wrong function
    Message 1 of 4 , Nov 7, 2007
    View Source
    • 0 Attachment
      Hey guys:

      i am new to flash, especially actionscript 3. I have some code that
      everytime it is run creates more memory. Please tell me what is wrong

      function startSlideShow()
      {
      if (counter > slideArray.length - 1) {
      counter = 0;
      }
      if (this.numChildren > 2)
      {
      removeChildAt(2);

      }

      trace(System.totalMemory);
      var b:BitmapLoader = new BitmapLoader(slideArray[counter]);
      addChild(b);
      trace(this.numChildren)
      b.x = 50;
      b.y = 35;
      counter +=1
      }
    • Josh Tynjala
      This group is meant for the discussion of Yahoo! Flash libraries and APIs, and not general ActionScript development questions. You ll probably get a better
      Message 2 of 4 , Nov 7, 2007
      View Source
      • 0 Attachment

        This group is meant for the discussion of Yahoo! Flash libraries and APIs, and not general ActionScript development questions. You’ll probably get a better response somewhere else like ActionScript.org or another dedicated Flash forum.

         

        My guess is that the BitmapLoader class you’re using may be the source of your problems, though I’m not completely certain since I don’t have access to the source code. It may be holding on to a reference of some sort that’s stopping garbage collection, possibly related to BitmapData.

         

        Josh Tynjala

        Yahoo! Flash Platform

         


        From: ydn-flash@yahoogroups.com [mailto: ydn-flash@yahoogroups.com ] On Behalf Of seinolf
        Sent: Wednesday, November 07, 2007 8:08 AM
        To: ydn-flash@yahoogroups.com
        Subject: [ydn-flash] HELP! Memory Leak

         

        Hey guys:

        i am new to flash, especially actionscript 3. I have some code that
        everytime it is run creates more memory. Please tell me what is wrong

        function startSlideShow( )
        {
        if (counter > slideArray.length - 1) {
        counter = 0;
        }
        if (this.numChildren > 2)
        {
        removeChildAt( 2);

        }

        trace(System. totalMemory) ;
        var b:BitmapLoader = new BitmapLoader( slideArray[ counter]) ;
        addChild(b);
        trace(this.numChild ren)
        b.x = 50;
        b.y = 35;
        counter +=1
        }

      • ogonzalez
        It s hard to tell without the source code, but the first thing you ll definitely want to do is add a void return type to your function, function
        Message 3 of 4 , Nov 21, 2007
        View Source
        • 0 Attachment
          It's hard to tell without the source code, but the first thing you'll definitely want to do is
          add a void return type to your function, function startSlideShow():void

          I'm not sure how much that will help but it should help some, hard to tell without seeing
          the rest of the code.

          --- In ydn-flash@yahoogroups.com, "seinolf" <seinolf@...> wrote:
          >
          > Hey guys:
          >
          > i am new to flash, especially actionscript 3. I have some code that
          > everytime it is run creates more memory. Please tell me what is wrong
          >
          > function startSlideShow()
          > {
          > if (counter > slideArray.length - 1) {
          > counter = 0;
          > }
          > if (this.numChildren > 2)
          > {
          > removeChildAt(2);
          >
          > }
          >
          > trace(System.totalMemory);
          > var b:BitmapLoader = new BitmapLoader(slideArray[counter]);
          > addChild(b);
          > trace(this.numChildren)
          > b.x = 50;
          > b.y = 35;
          > counter +=1
          > }
          >
        • Mike Krotscheck
          It looks to me like the BitmapLoader class is broken. Note that BitmapData objects are ignored by garbage collection unless you explicitly call dispose() on
          Message 4 of 4 , Nov 21, 2007
          View Source
          • 0 Attachment
            It looks to me like the BitmapLoader class is broken. Note that
            BitmapData objects are ignored by garbage collection unless you
            explicitly call dispose() on them first. That clears up any memory they
            were using.

            Michael Krotscheck
            Senior Developer

            RESOURCE INTERACTIVE
            www.resource.com
            mkrotscheck@...
            ____________________________________________________________________________
            This email and any of its attachments may contain Resource Interactive proprietary information, which is privileged, confidential and may be subject to copyright or other intellectual property rights belonging to Resource Interactive. This email is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this email, you are hereby notified that any dissemination, distribution, copying or action taken in relation to the contents of and attachments to this email is strictly prohibited and may be unlawful. If you have received this email in error, please notify the sender immediately and permanently delete the original and any copy of this email and any printout.


            -----Original Message-----
            From: ydn-flash@yahoogroups.com [mailto:ydn-flash@yahoogroups.com] On
            Behalf Of ogonzalez
            Sent: Wednesday, November 21, 2007 12:51 PM
            To: ydn-flash@yahoogroups.com
            Subject: [ydn-flash] Re: HELP! Memory Leak

            It's hard to tell without the source code, but the first thing you'll
            definitely want to do is
            add a void return type to your function, function startSlideShow():void

            I'm not sure how much that will help but it should help some, hard to
            tell without seeing
            the rest of the code.

            --- In ydn-flash@yahoogroups.com, "seinolf" <seinolf@...> wrote:
            >
            > Hey guys:
            >
            > i am new to flash, especially actionscript 3. I have some code that
            > everytime it is run creates more memory. Please tell me what is wrong
            >
            > function startSlideShow()
            > {
            > if (counter > slideArray.length - 1) {
            > counter = 0;
            > }
            > if (this.numChildren > 2)
            > {
            > removeChildAt(2);
            >
            > }
            >
            > trace(System.totalMemory);
            > var b:BitmapLoader = new
            BitmapLoader(slideArray[counter]);
            > addChild(b);
            > trace(this.numChildren)
            > b.x = 50;
            > b.y = 35;
            > counter +=1
            > }
            >






            Yahoo! Groups Links
          Your message has been successfully submitted and would be delivered to recipients shortly.