Order of deallocation of patches

benoitlahoz's picture

Hi !

I'm trying to check the order of deallocation of patches in a comp. I NSLogged all of my deallocations, but I don't know if I can really rely on the order it displays in the Console, and I really need to deallocate in a specific order.

I would be really grateful for any tips on this point.

Thank you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: Order of deallocation of patches

I don't think this is possible at all, and I'm not sure if QC ever was able to work this way, even in 10.5 when order of patch execution was more predictable.

I think - and someone please correct me if this is wrong - that each patch is thought to be responsible for memory management within the walls of it's own patch in QC. In the cases where I've seen some kind of nonstandard object being provided to another patch, both patches still are doing all memory management within that patch. (I realize deallocation and talking about non typical QC objects may be orthogonal to one another, but I'm thinking about openCV, where you sometimes want to move info between patches, and also tend to have to deal with memory mgmt doing various openCV activities.)

You can maybe test for something existing at an input port, or the patch being enabled or not, if you are finding a scenario where a patch being unplugged while running messes something up. You also usually have to restore all state, cleanup allocated resources, etc., in every patch to make sure that if someone deletes it from the editor nothing crashes or hangs around.

benoitlahoz's picture
Re: Order of deallocation of patches

Thanks for your reply @gtoledo3.

Actually, I made a kind of "I/O manager" to sort all this out, with a messages system. It would be great if Quartz was allowing to choose the deallocation order, especially when integrating an external library. Perhaps Vuo will ? :-)