Garbage Collector or Memory limit?

  • Jaw
  • Graduate
  • Graduate
  • User avatar
  • Posts: 132
  • Loc: Minneapolis, MN

Post 3+ Months Ago

I am working with a multidimensional array.

I have an array of building records and in the seventh position of each record is another array of images references for each building.


45 buildings are in my record set and for each building there can be 0 to 10 images.

Now, I can populate this multi dimensional array. Here is how cold fusion displays it - http://mx7.artropolis.com/esg/docs/CFC/test.cfm

After I've pulled the information in flash and traced it to verify it exists. I click on another property and the image array set disappears out of each of the first 10.

I've found a link that may suggest it is Garbage Collector related but I also wonder if there are memory limits to the array size.

Any thoughts?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

more like there's an error in your code.
  • Jaw
  • Graduate
  • Graduate
  • User avatar
  • Posts: 132
  • Loc: Minneapolis, MN

Post 3+ Months Ago

Flash is not robust enough to know that the array imageSet can NOT be filled by an array replacement.
so the follwing line was the bug (Note that propertyImages[i] contains an array.
)
Code: [ Select ]
imageSet = new Array();
imageSet = propertyImages[i];
  1. imageSet = new Array();
  2. imageSet = propertyImages[i];


flash considers imageSet a pointer and when imageset is reinitialized the data in propertyImages[i] is cleared.

This must be used instead to fill the array.

Code: [ Select ]
imageSet = new Array();
for(g=0; g < propertyImages[i].length; g++){
            imageSet[g] = propertyImages[i][g];
        }
  1. imageSet = new Array();
  2. for(g=0; g < propertyImages[i].length; g++){
  3.             imageSet[g] = propertyImages[i][g];
  4.         }
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

lool ... flash isn't robust enough :P. What you did there was setting a pointer, not copying the array, and it's very normal behavior. No programming language is going to copy the array unless you overload the "=" operator. For other p.o. there are implemented methods to copy the array, but they will not copy the array by only saying: myArray = someArray;
Oh my, i'm still amazed how people can come with the most weird ideas when the solution to their problems is usually very simple.
  • Jaw
  • Graduate
  • Graduate
  • User avatar
  • Posts: 132
  • Loc: Minneapolis, MN

Post 3+ Months Ago

No need to poke fun at me. I came back and posted to make sure others can learn from my mistake. Besides, the last time I distinctly remember using pointers was back in HS when I had learned a little bit of C and that was 10+ years ago.

On another note and in addition to what you are saying, the slice command can be used as a method for copying the array.

Code: [ Select ]
array2=array1.slice();
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

I'm not poking fun at you, i just made a remark. You're not the only one coming with weird ideas when the solution is right near them, there are others too.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 4 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.