Will it dispose?

Welcome to my new gameshow


I have an application patch (where you can’t directly put anything on dispose operation)
I want to make sure my channels dispose so I use a channel process node.

IF I put the output of the channel process node on Create like so…

Will dispose be called for this channel when the app quits?
If I hover it I don’t see any update running on the tooltip, which I guess makes sense it doesn’t need to do anything on update.
But what about dispose?

1 Like


(if the process node around it gets disposed, which depends on other factors, like where it is placed, and so on. or the other way around, if the dispose of the app patch can reach it (see it). or if you call it explicitly.)

to check whether you patch has a dispose, just open the code view and have a peek at the generated C#.

Let’s just focus on the fact that you are just innocently using a process node.

Typically, if some object gets handed to you by a process node it’s highly likely that it manages the lifetime of the object.

And when it’s the main output of the node it’s even guaranteed that the lifetime gets managed by the process node. That’s basically the language feature “process node”.

So when you call Create on some data type, you should try to figure out if a Dispose call is necessary, but when using a process node you should not need to bother

However, you don’t use the process node feature for the LiveProject. So that sounds like something you should bother about maybe.

So either call Create and Dispose manually or use the process node LiveProject. It would call Dispose for you when the Application gets stopped.

Note: a ProcessNode doesn’t necessarily need an Update. Having it sitting there just in order to manage the lifetime of the LiveProject is already a nice-to-have. Enable the State Output and feed that into the channel on Create. It looks pretty similar to what you have now, but is a little bit less imperative (no Create call and no need to think of a Dispose call) - it’s more declarative: there is this LiveProject in this Channel.

But if you indeed want to push different “projects” to the “CurrentProjectChannel” and want them to get shut down properly, please stick to what you have and Dipose the old “project” when pushing a new one. The only concern would be that maybe you want to delay the disposal until the next frame?

This reminds me of SerialDisposable which lets you manage a “current” disposable and when you set this property it makes sure that the old one gets disposed of.
It also reminds me of a Cache Region and the Synchronizer Regions. Soo… many many patterns to from - if you feel it’s somehow too dirty to call Dispose yourself from wherever you push a new Project to the channel. And yeah better go with a model-runtime approach where you push a new description of what you want to have and a runtime sync mechanism takes care of syncing to what you want…

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.