Memory leak when producing Sankey plots with Bokeh

Hi,
We have got a standalone script that producing Sankey plots regularly. The Sankey plot are produced using Bokeh. Our scripts has is memory increasing continuously. We need to restart the script every 3 to 4 days before exhausting the memory of the machine.

According to my analysis, the memory leak is due to bokeh objects not being released. Bokeh objects are released if they are not used by Holoviews.

I managed to reproduce this issue with a minimal example script:

import sys
import holoviews as hv
from collections import defaultdict
from bokeh.plotting import Figure
from bokeh.io import output_file
from bokeh.io import save
from pathlib import Path


DEFAULT_PLOT_WIDTH = 1200  # pixels
DEFAULT_PLOT_HEIGHT = 700  # pixels
TITLE_FONT_SIZE = "16pt"
LABEL_FONT_SIZE = "10pt"


def plot_port_targets(
        port_targets: dict,
        plot_width: int = DEFAULT_PLOT_WIDTH,
        plot_height: int = DEFAULT_PLOT_HEIGHT) -> Figure:
    hv.extension("bokeh")
    train_counts = defaultdict(int)
    for mine_name, port_names in port_targets.items():
        for port_name in port_names:
            train_counts[(mine_name, port_name)] += 1

    sankey = hv.Sankey(train_counts)
    sankey.opts(width=plot_width, height=plot_height)
    return hv.render(sankey)


def generate_html_file():
    output_file_path = Path('holoviews_memory_leak.html')
    planned_port_targets = {
        "Mine 1": [
            "Port 1",
            "Port 1",
            "Port 2",
            "Port 1",
            "Port 1",
            "Port 2",
            "Port 2",
            "Port 1"
        ],
        "Mine 2": [
            "Port 2",
            "Port 2",
            "Port 2"
        ],
        "Mine 3": [
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2"
        ],
        "Mine 4": [
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 1",
            "Port 2",
            "Port 1",
            "Port 2",
            "Port 2"
        ],
        "Mine 5": [
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 1",
            "Port 2",
            "Port 2"
        ],
        "Mine 6": [
            "Port 2",
            "Port 2"
        ],
        "Mine 7": [
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2"
        ],
        "Mine 8": [
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2",
            "Port 2"
        ]
    }

    planned_port_targets_plot = plot_port_targets(
        port_targets=planned_port_targets
    )
    output_file(output_file_path, title="Train Targets Visualisations", mode="inline")
    save(planned_port_targets_plot)


def main(argv):
    input('Press ENTER to start')
    for i in range(100):
        print('.', end='')
        generate_html_file()
    print('')
    input('Press ENTER to continue')
    for i in range(1000):
        if i % 100 or i == 0:
            print('.', end='')
        else:
            print('')
            print('.', end='')
        generate_html_file()
    print('')
    input('Press ENTER to continue')
    generate_html_file()
    input('Press ENTER to end')


if __name__ == '__main__':
    main(sys.argv)

This is the components versions:
OS Windows/Ubuntu
Python 3.7
bokeh 2.4.3
holoviews 1.14.9

Please can you advise why is the memory leak is happening.
Thanks
Gilles