Closed
Description
Bug report
Bug description:
I am currently having an issue when using Path.exists()
function. It seems that if you use it for intensive usage, I have a memory leak.
Here is a python script, where I iterate over some items, and when I called the exists()
function it seems the RAM keeps growing.
from collections.abc import Iterator
from pathlib import Path
def check_file(filename: Path) -> None:
if filename.exists():
return
return
def iterate() -> Iterator[int]:
yield from range(10_000_000)
if __name__ == "__main__":
directory = Path("/")
for item in iterate():
filename = directory / str(item)
check_file(filename)
Here also a screen shot that I have using memory_profiler
library to illustrate it.
I do not know if I am missing something here... Let me know if you need more info to reproduce it. I am using Python 3.12.3
on Ubuntu 22.04.4 LTS
.
Thanks
CPython versions tested on:
3.12
Operating systems tested on:
Linux