flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.5k stars 449 forks source link

Possible memory leak in flet.exe when updating page after LineChartDataPoint.y is changed #4385

Open Zodein opened 5 days ago

Zodein commented 5 days ago

Duplicate Check

Describe the bug

Memory usage keeps increasing with each 'page.update() after a LineChartDataPoint.y is changed'

Code sample

Code ```python import flet as ft import threading import random import time def start(page: ft.Page): history = [] for i in range(100): history.append(ft.LineChartDataPoint(i, 0)) line_chart = ft.LineChart(data_series=[ft.LineChartData(data_points=history)]) page.add(line_chart) def change_random(): while page.loop.is_running(): x = int(random.random() * 99) y = int(random.random() * 99) history[x].y = y page.update() time.sleep(0.01) t = threading.Thread(target=change_random) t.start() ft.app(target=start) ```

To reproduce

Just run the code and watch memory usage of flet.exe

Expected behavior

No response

Screenshots / Videos

Captures https://github.com/user-attachments/assets/0be61389-7c84-4961-b644-c651221ee5cd

Operating System

Windows

Operating system details

Windows 11

Flet version

0.24.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs ```console [Paste your logs here] ```

Additional details

No response