Commit ce19aa4
committed
Fix queue.SimpleQueue.__sizeof__() to account for buffer
Fixes #140025
The __sizeof__() method for queue.SimpleQueue previously ignored
the underlying RingBuf data structure, only returning the basic
object size.
Now properly accounts for the dynamically allocated items array
in the RingBuf, which grows with the queue capacity:
- Returns base object size + (items_cap * sizeof(PyObject*))
This gives accurate memory usage for SimpleQueue instances.1 parent b6b0e14 commit ce19aa4
1 file changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
527 | 536 | | |
528 | 537 | | |
529 | 538 | | |
| |||
534 | 543 | | |
535 | 544 | | |
536 | 545 | | |
| 546 | + | |
| 547 | + | |
537 | 548 | | |
538 | 549 | | |
539 | 550 | | |
| |||
0 commit comments