HPCC-12408 Various code generator optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
probably i2 because there was previously an i loop.  Yes these items are now linked/released to avoid that issue.