forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5dd7fc1
committed
Add transparent block-level memory accounting
Adds accounting of memory allocated in a memory context. Compared tovarious ad hoc solutions, the main advantage is that the accounting istransparent and does not require direct control over allocations (thismatters for use cases where the allocations happen in user code, likefor example aggregate states allocated in a transition functions).To reduce overhead, the accounting happens at the block level (not forindividual chunks) and only the context immediately owning the block isupdated. When inquiring about amount of memory allocated in a context,we have to recursively walk all children contexts.This "lazy" accounting works well for cases with relatively small numberof contexts in the relevant subtree and/or with infrequent inquiries.Author: Jeff DavisReivewed-by: Tomas Vondra, Melanie Plageman, Soumyadeep ChakrabortyDiscussion:https://www.postgresql.org/message-id/flat/027a129b8525601c6a680d27ce3a7172dab61aab.camel@j-davis.com1 parent36d22dd commit5dd7fc1
File tree
7 files changed
+121
-0
lines changed- src
- backend/utils/mmgr
- include
- nodes
- utils
7 files changed
+121
-0
lines changedLines changed: 34 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 |
| |
27 | 31 |
| |
28 | 32 |
| |
| |||
452 | 456 |
| |
453 | 457 |
| |
454 | 458 |
| |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + |
Lines changed: 38 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
458 | 458 |
| |
459 | 459 |
| |
460 | 460 |
| |
| 461 | + | |
| 462 | + | |
| 463 | + | |
461 | 464 |
| |
462 | 465 |
| |
463 | 466 |
| |
| |||
546 | 549 |
| |
547 | 550 |
| |
548 | 551 |
| |
| 552 | + | |
| 553 | + | |
549 | 554 |
| |
550 | 555 |
| |
551 | 556 |
| |
| |||
566 | 571 |
| |
567 | 572 |
| |
568 | 573 |
| |
| 574 | + | |
569 | 575 |
| |
570 | 576 |
| |
571 | 577 |
| |
| |||
604 | 610 |
| |
605 | 611 |
| |
606 | 612 |
| |
| 613 | + | |
| 614 | + | |
607 | 615 |
| |
608 | 616 |
| |
609 | 617 |
| |
| |||
612 | 620 |
| |
613 | 621 |
| |
614 | 622 |
| |
| 623 | + | |
| 624 | + | |
615 | 625 |
| |
616 | 626 |
| |
617 | 627 |
| |
| |||
628 | 638 |
| |
629 | 639 |
| |
630 | 640 |
| |
| 641 | + | |
631 | 642 |
| |
632 | 643 |
| |
633 | 644 |
| |
| |||
683 | 694 |
| |
684 | 695 |
| |
685 | 696 |
| |
| 697 | + | |
| 698 | + | |
| 699 | + | |
686 | 700 |
| |
687 | 701 |
| |
688 | 702 |
| |
| |||
693 | 707 |
| |
694 | 708 |
| |
695 | 709 |
| |
| 710 | + | |
| 711 | + | |
696 | 712 |
| |
697 | 713 |
| |
698 | 714 |
| |
| |||
733 | 749 |
| |
734 | 750 |
| |
735 | 751 |
| |
| 752 | + | |
| 753 | + | |
| 754 | + | |
736 | 755 |
| |
737 | 756 |
| |
738 | 757 |
| |
| |||
928 | 947 |
| |
929 | 948 |
| |
930 | 949 |
| |
| 950 | + | |
| 951 | + | |
931 | 952 |
| |
932 | 953 |
| |
933 | 954 |
| |
| |||
1028 | 1049 |
| |
1029 | 1050 |
| |
1030 | 1051 |
| |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1031 | 1055 |
| |
1032 | 1056 |
| |
1033 | 1057 |
| |
| |||
1144 | 1168 |
| |
1145 | 1169 |
| |
1146 | 1170 |
| |
| 1171 | + | |
1147 | 1172 |
| |
1148 | 1173 |
| |
1149 | 1174 |
| |
| |||
1159 | 1184 |
| |
1160 | 1185 |
| |
1161 | 1186 |
| |
| 1187 | + | |
| 1188 | + | |
1162 | 1189 |
| |
1163 | 1190 |
| |
1164 | 1191 |
| |
1165 | 1192 |
| |
1166 | 1193 |
| |
1167 | 1194 |
| |
1168 | 1195 |
| |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
1169 | 1199 |
| |
1170 | 1200 |
| |
1171 | 1201 |
| |
| |||
1383 | 1413 |
| |
1384 | 1414 |
| |
1385 | 1415 |
| |
| 1416 | + | |
1386 | 1417 |
| |
1387 | 1418 |
| |
1388 | 1419 |
| |
| |||
1393 | 1424 |
| |
1394 | 1425 |
| |
1395 | 1426 |
| |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1396 | 1432 |
| |
1397 | 1433 |
| |
1398 | 1434 |
| |
| |||
1479 | 1515 |
| |
1480 | 1516 |
| |
1481 | 1517 |
| |
| 1518 | + | |
| 1519 | + | |
1482 | 1520 |
| |
1483 | 1521 |
| |
1484 | 1522 |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
297 | 297 |
| |
298 | 298 |
| |
299 | 299 |
| |
| 300 | + | |
| 301 | + | |
300 | 302 |
| |
301 | 303 |
| |
302 | 304 |
| |
| |||
352 | 354 |
| |
353 | 355 |
| |
354 | 356 |
| |
| 357 | + | |
| 358 | + | |
355 | 359 |
| |
356 | 360 |
| |
357 | 361 |
| |
| |||
407 | 411 |
| |
408 | 412 |
| |
409 | 413 |
| |
| 414 | + | |
| 415 | + | |
410 | 416 |
| |
411 | 417 |
| |
412 | 418 |
| |
| |||
522 | 528 |
| |
523 | 529 |
| |
524 | 530 |
| |
| 531 | + | |
525 | 532 |
| |
526 | 533 |
| |
527 | 534 |
| |
| |||
746 | 753 |
| |
747 | 754 |
| |
748 | 755 |
| |
| 756 | + | |
749 | 757 |
| |
750 | 758 |
| |
751 | 759 |
| |
| |||
755 | 763 |
| |
756 | 764 |
| |
757 | 765 |
| |
| 766 | + | |
| 767 | + | |
758 | 768 |
| |
759 | 769 |
| |
760 | 770 |
| |
| |||
833 | 843 |
| |
834 | 844 |
| |
835 | 845 |
| |
| 846 | + | |
| 847 | + | |
836 | 848 |
| |
837 | 849 |
| |
838 | 850 |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
462 | 462 |
| |
463 | 463 |
| |
464 | 464 |
| |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
465 | 489 |
| |
466 | 490 |
| |
467 | 491 |
| |
| |||
736 | 760 |
| |
737 | 761 |
| |
738 | 762 |
| |
| 763 | + | |
739 | 764 |
| |
740 | 765 |
| |
741 | 766 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
305 | 305 |
| |
306 | 306 |
| |
307 | 307 |
| |
| 308 | + | |
308 | 309 |
| |
309 | 310 |
| |
310 | 311 |
| |
311 | 312 |
| |
312 | 313 |
| |
313 | 314 |
| |
| 315 | + | |
314 | 316 |
| |
315 | 317 |
| |
316 | 318 |
| |
| |||
388 | 390 |
| |
389 | 391 |
| |
390 | 392 |
| |
| 393 | + | |
391 | 394 |
| |
392 | 395 |
| |
393 | 396 |
| |
| |||
480 | 483 |
| |
481 | 484 |
| |
482 | 485 |
| |
| 486 | + | |
| 487 | + | |
| 488 | + | |
483 | 489 |
| |
484 | 490 |
| |
485 | 491 |
| |
| |||
555 | 561 |
| |
556 | 562 |
| |
557 | 563 |
| |
| 564 | + | |
558 | 565 |
| |
559 | 566 |
| |
560 | 567 |
| |
561 | 568 |
| |
562 | 569 |
| |
| 570 | + | |
563 | 571 |
| |
564 | 572 |
| |
565 | 573 |
| |
| |||
782 | 790 |
| |
783 | 791 |
| |
784 | 792 |
| |
| 793 | + | |
| 794 | + | |
785 | 795 |
| |
786 | 796 |
| |
787 | 797 |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
79 | 79 |
| |
80 | 80 |
| |
81 | 81 |
| |
| 82 | + | |
82 | 83 |
| |
83 | 84 |
| |
84 | 85 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| 85 | + | |
85 | 86 |
| |
86 | 87 |
| |
87 | 88 |
| |
|
0 commit comments
Comments
(0)