# Do chngetk etc. allocate a new array on each k-cycle?

**URL:** <https://forum.csound.com/t/do-chngetk-etc-allocate-a-new-array-on-each-k-cycle/2231>\
**Category:** Newbies\
**Created:** [July 31, 2025, 7:59pm UTC](https://forum.csound.com/t/do-chngetk-etc-allocate-a-new-array-on-each-k-cycle/2231 "2025-07-31T19:59:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noise](https://forum.csound.com/user_avatar/forum.csound.com/noise/32/564_2.png) [@Noise](https://forum.csound.com/u/Noise)\
**Post date:** [July 31, 2025, 7:59pm UTC](https://forum.csound.com/t/do-chngetk-etc-allocate-a-new-array-on-each-k-cycle/2231/1 "2025-07-31T19:59:52Z")

</div>

In order not to write a whole bunch of `chnget`s to individual variables, If I write something like:

```csound
kargs[] chngetk gSiXpnames

```

Will that ‘spam’ allocate a new array on each k-cycle, or will the same array be reused? In Csound 6.

I don’t alas know how to profile anything in Csound relating to mem allocs.

Looking at

```csound
 { "chngetk.k", S(CHNGET),_CR, 3, "k[]", "S[]",
    (SUBR) chnget_array_opcode_init, (SUBR) notinit_opcode_stub, NULL },

```

it seems it does all the work at i-time? I don’t understand how that’s even possible for `chngetk`. Ah, I see that init mutates the entry table!

```csound
    if(channelType == (CSOUND_CONTROL_CHANNEL | CSOUND_INPUT_CHANNEL))
        p->h.opadr = (SUBR) chnget_array_opcode_perf_k;

```

---

<div class="post-metadata">

**Author:** ![Noise](https://forum.csound.com/user_avatar/forum.csound.com/noise/32/564_2.png) [@Noise](https://forum.csound.com/u/Noise)\
**Post date:** [July 31, 2025, 8:19pm UTC](https://forum.csound.com/t/do-chngetk-etc-allocate-a-new-array-on-each-k-cycle/2231/2 "2025-07-31T20:19:47Z")

</div>

> [@Noise](#):
>
> `chnget_array_opcode_perf_k`

And in the code of the latter it does no allocations, so it reuses the same destination array.
