---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
  --> B019.py:78:5
   |
77 |     # Remaining methods should emit B019
78 |     @functools.cache
   |     ^^^^^^^^^^^^^^^^
79 |     def cached_instance_method(self, y):
80 |         ...
   |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
  --> B019.py:82:5
   |
80 |         ...
81 |
82 |     @cache
   |     ^^^^^^
83 |     def another_cached_instance_method(self, y):
84 |         ...
   |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
  --> B019.py:86:5
   |
84 |         ...
85 |
86 |     @functools.cache()
   |     ^^^^^^^^^^^^^^^^^^
87 |     def called_cached_instance_method(self, y):
88 |         ...
   |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
  --> B019.py:90:5
   |
88 |         ...
89 |
90 |     @cache()
   |     ^^^^^^^^
91 |     def another_called_cached_instance_method(self, y):
92 |         ...
   |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
  --> B019.py:94:5
   |
92 |         ...
93 |
94 |     @functools.lru_cache
   |     ^^^^^^^^^^^^^^^^^^^^
95 |     def lru_cached_instance_method(self, y):
96 |         ...
   |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
   --> B019.py:98:5
    |
 96 |         ...
 97 |
 98 |     @lru_cache
    |     ^^^^^^^^^^
 99 |     def another_lru_cached_instance_method(self, y):
100 |         ...
    |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
   --> B019.py:102:5
    |
100 |         ...
101 |
102 |     @functools.lru_cache()
    |     ^^^^^^^^^^^^^^^^^^^^^^
103 |     def called_lru_cached_instance_method(self, y):
104 |         ...
    |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
   --> B019.py:106:5
    |
104 |         ...
105 |
106 |     @lru_cache()
    |     ^^^^^^^^^^^^
107 |     def another_called_lru_cached_instance_method(self, y):
108 |         ...
    |

B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
   --> B019.py:124:5
    |
123 | class Metaclass(type):
124 |     @functools.lru_cache
    |     ^^^^^^^^^^^^^^^^^^^^
125 |     def lru_cached_instance_method_on_metaclass(cls, x: int):
126 |         ...
    |
