[Swift-devel] Swift crashing for runs with 1M calls

Yadu Nand yadudoc1729 at gmail.com
Mon Mar 11 09:51:05 CDT 2013


Hi Mihael,

This kind of information helps a lot.

> Yeah, the algorithm for finding loops is recursive. Since it has to deal
> with 1M threads, it does fail. The code may not be recursive, but the
> dependency is, so when the hang checker builds the dependency graph, it
> will essentially try to build a graph that tracks where, say,
> array[1000000] is. The complexity of that  is 2^n in this case, so,
> yeah...

So, any loop large enough with a dependency on previous values could
trigger this error ? Throwing more memory into the system or giving more
time wouldn't help this, right ?

I'm also seeing swift hung, after I removed the dependency, probably a
different issue.
Here's what I see : http://pastebin.com/J9V3xyqU
I killed the process after 15 mins.

> One solution may be to stop the hang checker when things get too big.
> That way it can still be useful for normal stuff.
>
> The hang checker's invocation here is unfortunate though. the assignment
> int range[] = [2:limit:1]; does the silly thing of actually creating an
> array with 1M elements (if you say foreach v in range..., that does not
> happen). It may be useful to change setFieldValue to do a simple
> reference assignment instead of copying the entire array, but that might
> not be easy given the way that assignment is implemented (i.e. not when
> the array is created).

Did you mean to say that foreach v in [2:limit:1] would avoid having the
1 million array elements created in range[] ? In what way would this
affect the execution of the script, make it faster ?


-- 
Thanks,
Yadu Nand B



More information about the Swift-devel mailing list