If your version of AWK follows the standards, the initialization you're doing in unneeded, and this code should produce the same result:
Code:
BEGIN {print "Hai"}
#extractig ICA to ICA_arr
/ICA/ {ICA_arr[++max]= $1}
END {print "max =" max;for (i=1; i<=max; ++i) {print ICA_arr[i]}
That doesn't address your "out of memory" problem.
Here's one possibility: If your ICA_array contains many duplicated values, you could just store each value once:
Code:
BEGIN {print "Hai"}
#extractig ICA to ICA_arr
/ICA/ {ICA_values[$1]=ICA_values[$1] SUBSEP ++max SUBSEP}
END {
print "max =" max
for (i=1; i<=max; ++i) {
for (ICA_arr in ICA_values) {
if (ICA_values[ICA_arr] ~ SUBSEP i SUBSEP) {
print ICA_arr
break
}
}
}
}
Note: Untested code since you failed to post any test data . . .