Since templates reside in NiFi heap, they should only be uploaded to the NiFi for the purpose of instantiating that template to the canvas. Once instantiate on to the canvas, the template should be deleted from the NiFi, so it is no longer holding that memory space.
In addition to uploaded templates consuming heap memory space, so does everything build on the canvas (including controller services, and reporting tasks.). Additionally the metrics for each component also reside within heap memory space. Additionally, all FlowFiles queued (except large queues resulting in swap files) will also reside in the NiFi JVM heap memory space. How much heap each FlowFile consumes is driven by the number and size of the FlowFile attributes on each FlowFile (FlowFile content does not reside in heap memory except when a processor needs to do so to perform its task and not all processors need to touch the content at all and other may also read it without needing to hold it in heap if it is streaming it somewhere else.). The impact on heap various based on what components are being used and how many. If your flow grow extremely large, it may be a case of breaking those flows to be managed by Multiple NiFi clusters.
NiFi flow templates will become a deprecated capability in favor of NiFi-Registry. You can version control your flows in to NiFi-Registry. All NiFi's connected to this NiFi-Registry can then load Flows from NiFi-Registry to the canvas (one or more times).
I am not sure what you are looking for with regards to "How does it manage individual processors in memory?" All processors residing within the canvas and within templates will reside in the JVM heap memory space.
If you find this helps with yoru query, please take a moment to login and click "ACCEPT" on this solution.
Thank you,
Matt

