I have tried various methods, but the memory is definitely leaking, it seems that the release of memory cannot keep up. Through the logs, it can be found that there is periodic memory recycling, but with the increase of time, there is still a clear upward trend

Name: keras Version: 3.6.0

Please find the gist here for your reference.

https://github.com/tensorflow/tensorflow/issues/80753#issuecomment-2503203801

Comment From: fchollet

Is this reproducible with a different backend?

TF has some well known memory leak issues, but there isn't anything we can do about it on the Keras side, unless the issue is also visible in other backends (in which case the issue is with the Keras codebase).

Comment From: RHTNT

It is a tensorflow bug. I searched through virtually all issues related to this bug and basically there are one or maybe two approaches apprently: 1) Run your code in a separate process, retrieve the output somehow and kill the process. That way the memory will be freed. 2) Maybe @https://github.com/tensorflow/tensorflow/issues/80753#issuecomment-2559339312 works for you.

Comment From: github-actions[bot]

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

Comment From: github-actions[bot]

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

Comment From: google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No