Commit b316a07
committed
Break reference cycles and harden async chunk reader
- FieldsAccessor: use weakref to parent NDArray and create NDField
instances on access instead of eagerly. Breaks NDArray↔NDField
reference cycles so gen-0/gen-1 GC can collect them, reducing
thread accumulation on Python 3.14.
- sync_read_chunks: wrap reader thread in try/finally with
thread.join() to prevent thread leaks. Propagate exceptions
from the async reader instead of silently swallowing them.
Detect dead reader thread to avoid infinite wait on empty queue.
- ThreadPoolExecutor: cap max_workers to min(len(arrs), nthreads)
instead of os.cpu_count(), avoiding excess threads when there
are few operands.1 parent 7fbedef commit b316a07
2 files changed
Lines changed: 50 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1182 | 1182 | | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | | - | |
| 1185 | + | |
| 1186 | + | |
1186 | 1187 | | |
1187 | 1188 | | |
1188 | 1189 | | |
| |||
1213 | 1214 | | |
1214 | 1215 | | |
1215 | 1216 | | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
1216 | 1226 | | |
1217 | 1227 | | |
1218 | | - | |
| 1228 | + | |
1219 | 1229 | | |
1220 | 1230 | | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
1229 | | - | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1230 | 1249 | | |
1231 | 1250 | | |
1232 | 1251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
149 | | - | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | | - | |
| 166 | + | |
157 | 167 | | |
158 | 168 | | |
159 | | - | |
| 169 | + | |
160 | 170 | | |
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
164 | 174 | | |
165 | | - | |
| 175 | + | |
| 176 | + | |
166 | 177 | | |
167 | 178 | | |
168 | 179 | | |
| |||
175 | 186 | | |
176 | 187 | | |
177 | 188 | | |
178 | | - | |
| 189 | + | |
179 | 190 | | |
180 | 191 | | |
181 | 192 | | |
| |||
3730 | 3741 | | |
3731 | 3742 | | |
3732 | 3743 | | |
3733 | | - | |
3734 | | - | |
3735 | | - | |
3736 | | - | |
3737 | | - | |
| 3744 | + | |
| 3745 | + | |
3738 | 3746 | | |
3739 | 3747 | | |
3740 | 3748 | | |
| |||
0 commit comments