Channel cleanup?

Have a quick question on channel initialization and deallocation. Are channels initialized via chnget/chnset automatically deallocated on an instrument being disabled or should these channels be manually deallocated before disabling an instrument? How does one manually close/disable/deallocate a channel?

EDIT: Is it completely unnecessary to do this? I assume that this takes up memory somewhere but maybe my understanding of how channels work is incorrect. Just trying to make sure I don’t wind up with any memory leaks or underlying issues that could cause problems for my program later on down the line

I imagine that once they are initialised they hang around until an orc exits. I don’t expect this would ever lead to any real memory problems. The max amount of memory they can hog is a single ksmps buffer of doubles in the case of an audio -rate channel. On the other hand, if you somehow wish to create a new channel on each k-cycle for some strange reason, you might see issues :man_shrugging: Darn it we need more devs on this list! @stevenyi hangs out a lot of discord. He’s the guy to ask. If you do get a satisfactory answer can you post it here so others will know. It’s so hard to find anything on discord :laughing:

Oh sweet, I didn’t see that there was a Discord group, I’ll go ahead and join that

That’s a good point. I actually think for my current case it won’t matter too much, I was mostly just curious if these channels remain after instrument’s are turned off and if there were any opcodes specifically designed to disable channels. If I find any answers to this I’ll follow up here :smiley:

I’m not sure anyone has asked for channel deletion. I can imagine it being precarious if a channel was used in many places and then deleted (though there are other scenarios like ftables where this can happen). In general it’s not a lot of memory and I wouldn’t imagine it causing problems unless one is constantly adding new channels; if that is the case, there’s probably other ways to go about the problem.

1 Like