0 Replies Latest reply on Nov 22, 2012 6:38 PM by StephenWonfor

    How to blow up FMP 12 by totally inappropriate use of 2^n




      This is on a Macbook Pro 8GB Ram, 2.5 Ghz i7.


      I wrote a rather fun little script whose purpose was to stuff data into two variables ($$Picklist and $$Sublist) - at most 50 values into each. A stack of 5 digits numbers into one and a stack of single letters into the other.

      Then a loop to join them together into a single variable eg.

      89977 (A)

      98756 (F)...

      Set Variable [ $Values; Value:ValueCount($$PickList) ] Set Variable [ $Count; Value:1 ]
      Set Variable [ $$MergeList; Value:

      Let( [
      x = $$MergeList;
      y = GetValue($$Picklist; $Count);

      z = GetValue($$Sublist; $Count) ];
      not IsEmpty($$MergeList); $$MergeList & "¶") & x & "(" & y & ")"

      Set Variable [ $Count; Value:1 + $Count ]

      Exit Loop If [ $Count > $Values ]
      End Loop

      The key part being the & x & "(" & y & ")" where I in fact was shoving $$Mergelist into itself. Should have been & y & "(" & z & ")". $Values in this case = 31, and every single time I ran the script FMPA12.0v3 would crash. Didn't matter if the file was local or hosted.

      Seems I was doing an inadvertent powers of 2 test. Watching in the script debugger I noticed that $$MergeLlist was not acting as planned. The file crashes on the 23rd ( 2^23) iteration when $$Mergelist has around 210 million rows in it. As soon as the next loop starts Filemaker unexpectedly quits. Although, to be honest, after my sleuthing I find it rather "expected".

      I guess variables have their limits. Likely the same 1,000,000,000 characters that a field is allowed to have. 200 million x ~10 seems about right for that.

      I guess now I can re-enable all my plugins...;-)






      "Error: The operation completed successfully. Fatal error code 0: No error."