metal delegate memory leak
@mengran1234,
Could you please provide the complete code to reproduce the issue which helps us to analyse the issue in an effective way. Thank you! I calls this three function loop on ios,and find memory leak
use TFLGpuDelegateCreate --》 TfLiteInterpreterModifyGraphWithDelegate --》 TFLGpuDelegateDelete

xcode profile tool (memory leak)can be see. [](url)
![IMG_8782 HEIC JPG](https://github.com/tensorflow/tensorflow/assets/87115287/dec86542-d4b5-4584-8491-f369ea2d37cf)
 please help to see it > I calls this three function loop on ios,and find memory leak use TFLGpuDelegateCreate --》 TfLiteInterpreterModifyGraphWithDelegate --》 TFLGpuDelegateDelete
> 
> xcode profile tool (memory leak)can be see.

I understand what you're doing, but I'd like to see your code snippet.  Can you copy & paste your code snippet here?

Also, can you attach your tflite file or a link if it's an open source model?  If it's not opensource, but is proprietary, how big is the model, and what kind of ops does it have? any tflite file, let it run gpu delegate (metal )on iphone,thank you https://github.com/tensorflow/tensorflow/issues/57718
my question is the same with this FYI, we ran into a memory usage issue in CoreML delegate when switching from Xcode 12 to 13 (see #53461). It turned out I have to add some `@autoreleasepool` as in #53468 Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60624">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60624">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

2.10 or 2.11

### Custom Code

Yes

### OS Platform and Distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

A bug happened!
I  calls this three function loop on ios,and find memory leak
 use TFLGpuDelegateCreate --》 TfLiteInterpreterModifyGraphWithDelegate --》  TFLGpuDelegateDelete
 
![191225054-cfc30bd2-cc8d-4b42-97c5-131ffdbde9d3](https://github.com/tensorflow/tensorflow/assets/87115287/908eb0f8-ac63-4b4d-8959-8e377f75b3b4)


### Standalone code to reproduce the issue

```shell
From my own investigation it seems that the leak is coming from ModifyGraphWithDelegate, instead of Invoke.Attached is a screenshot of instruments, and a 5MB growth per call。
```


### Relevant log output

_No response_</details>