Delete partitions from projection

Hello Community!

Where are partitions stored? Only in RAM or maybe also on disk?
I have projection (simplified code below) which will produce hundreds of thousands partitions per month. And 99.99% of these partitions will no longer be needed because new events for these partitions will never come again. How to release resources (delete partitions) after few months of working? Should I just stop and start projection again? There is a “Cached Partitions” property which is set to zero when I stop and start projection. But the word “cached” bothers me that these aren’t all partitions.

fromStream("source-stream")
.partitionBy(function (event) { return event.data.CorrelationId; })
.when({
    $init: function (state, event) { return { "startEvent": null } },
    "EventA": function (state, event) {
        state.startEvent = event;
    },
    "EventB": function (state, event) {
        t1 = Date.parse(state.startEvent.data.PushTime);
        t2 = Date.parse(event.data.PushTime);
        emit("dest-stream", "IntervalEvent", {                
            intervalMs: t2 - t1
        });
    },
});

Really keen to hear the answer to this.

I wonder if this is the answer.

Have a look at at a stream in this format:

$projections---checkpoint

The checkpoint seems to hold the state for the projection.

Thanks for the advice, but eventually I gave up using projection for computing interval between events. I’m going to do it in .Net C# so I will have full control and understanding.
From now, I plan to use projections only for the simplest tasks - rewriting one stream into another, for example.