`Segmentation fault` in `tf.raw_ops.TensorArrayV3` when the value of  `size` is too large.
Hi @xl1043237213 ,

I am facing OOM error while checking on Colab(12.67 GB RAM). To confirm the problem could you please confirm the RAM size of your environment. Thanks! Thanks for your response. 
`Segmentation fault` can be triggered in memory-constrained conditions. I triggered the error using a lightweight server (2G of memory). On a server with 128G of RAM, the code can be executed, but it fills up all memory. I have updated the colab code and simulated the memory constrained situation using `resource`. Hi @xl1043237213 ,

Thanks for more details. With the modified code I can observe the session crash on colab.Attached screenshot below for reference.

<img width="1512" alt="Screenshot 2024-04-18 at 11 31 23 AM" src="https://github.com/tensorflow/tensorflow/assets/116063290/db383f2e-fdb8-485d-adaf-cc4125aa75c3">

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

binary

### TensorFlow version

tf 2.15

### Custom code

No

### OS platform and distribution

Linux Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.10

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

`Segmentation fault` in `tf.raw_ops.TensorArrayV3` when the value of  `size` is too large.

### Standalone code to reproduce the issue

```shell
https://colab.research.google.com/drive/1QR3h-YYHGAXpkqt_xxsZFuEyuP70llBT?usp=sharing
```


### Relevant log output

```shell
segmentation fault (core dumped)
```
