String concatenation in ForEach loop crashes vvvv gamma 6.3

Hi, I’m trying to write a formatted file of 60000 vector3 values, however every time I’m using accumulator on string data vvvv gamma 6.3 just crashes.

I tried to use it with and without cache region, same result. What I’m doing wrong?

Please see the test files attached.

stringify-test.vl (10.8 KB)
stringify-test-cache.vl (16.2 KB)

I found that the Join node can be used for string concatenation, it makes process more memory efficient, so vvvv doesn’t crash. However, for myself it seems that joining 60000 stringifyed vector3 values through accumulator should be possible without any memory optimizations.

The first part of your patch generates 600.000 strings, each ~25 characters long so roughly we speak about 15 MB of data. Running that part is not the issue. However the second part is problematic, as it runs over the 600.000 strings and in each iteration allocates a new string with all the results from the previous iterations. In the 1. iteration that’s 25 characters, in the 2. 25 + 25, in the 3. 50 + 25, … this goes up to 600.000, which is roughly (600.000 * 600.001) / 2 * 25 = 4.500.007.500.000 = 4,5 TB of allocations basically sending the garbage collector into a 24 7 work week ;) So yes, Join [String] or a StringBuilder as the accumulator is the way to go here.