Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some text entry leaks on Darwin. #21317

Merged

Conversation

woody-apple
Copy link
Contributor

We can get OnNewInterface twice for the same interface. When the happens we
replace the old InterfaceInfo with a new one in the map. Because our cleanup
was from ~ResolveContext, that meant we leaked any allocated memory the
InterfaceInfo was holding on to.

The fix is to make InterfaceInfo manage its own memory and make sure we transfer
the ownership properly via move constructors when inserting into the map.

Problem

See above.

Change overview

See above.

Testing

Ran darwin-framework-tool pairing code with LeakSanitizer and observed that the leak that had detected without these changes is gone.

We can get OnNewInterface twice for the same interface.  When the happens we
replace the old InterfaceInfo with a new one in the map.  Because our cleanup
was from ~ResolveContext, that meant we leaked any allocated memory the
InterfaceInfo was holding on to.

The fix is to make InterfaceInfo manage its own memory and make sure we transfer
the ownership properly via move constructors when inserting into the map.
@github-actions
Copy link

github-actions bot commented Jul 28, 2022

PR #21317: Size comparison from d4fb03c to 6b6483a

Increases (3 builds for bl602, cc13x2_26x2, telink)
platform target config section d4fb03c 6b6483a change % change
bl602 lighting-app bl602 (read/write) 1381202 1381210 8 0.0
.text 1051196 1051200 4 0.0
cc13x2_26x2 lock-mtd LP_CC2652R7 (read only) 653459 653467 8 0.0
.text 551816 551824 8 0.0
telink lighting-app tlsr9518adk80d text 583666 583670 4 0.0
Decreases (2 builds for cc13x2_26x2, esp32)
platform target config section d4fb03c 6b6483a change % change
cc13x2_26x2 lock-mtd LP_CC2652R7 (read/write) 183780 183772 -8 -0.0
esp32 all-clusters-app c3devkit (read only) 1022498 1022496 -2 -0.0
.flash.text 1022498 1022496 -2 -0.0
Full report (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section d4fb03c 6b6483a change % change
bl602 lighting-app bl602 (read/write) 1381202 1381210 8 0.0
.bss 117610 117610 0 0.0
.data 4480 4480 0 0.0
.text 1051196 1051200 4 0.0
bl602+rpc (read/write) 1426634 1426634 0 0.0
.bss 125050 125050 0 0.0
.data 4600 4600 0 0.0
.text 1082892 1082892 0 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 668235 668235 0 0.0
(read/write) 183124 183124 0 0.0
.bss 74252 74252 0 0.0
.data 3356 3356 0 0.0
.rodata 88411 88411 0 0.0
.text 579508 579508 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 633819 633819 0 0.0
(read/write) 157820 157820 0 0.0
.bss 73548 73548 0 0.0
.data 3356 3356 0 0.0
.rodata 77635 77635 0 0.0
.text 555860 555860 0 0.0
lock-ftd LP_CC2652R7 (read only) 671231 671231 0 0.0
(read/write) 170320 170320 0 0.0
.bss 71332 71332 0 0.0
.data 3280 3280 0 0.0
.rodata 76463 76463 0 0.0
.text 594288 594288 0 0.0
lock-mtd LP_CC2652R7 (read only) 653459 653467 8 0.0
(read/write) 183780 183772 -8 -0.0
.bss 67020 67020 0 0.0
.data 3280 3280 0 0.0
.rodata 101163 101163 0 0.0
.text 551816 551824 8 0.0
pump-app LP_CC2652R7 (read only) 680671 680671 0 0.0
(read/write) 161712 161712 0 0.0
.bss 71396 71396 0 0.0
.data 3280 3280 0 0.0
.rodata 89175 89175 0 0.0
.text 591012 591012 0 0.0
pump-controller-app LP_CC2652R7 (read only) 666431 666431 0 0.0
(read/write) 176088 176088 0 0.0
.bss 71532 71532 0 0.0
.data 3276 3276 0 0.0
.rodata 85007 85007 0 0.0
.text 580944 580944 0 0.0
shell LP_CC2652R7 (read only) 660686 660686 0 0.0
(read/write) 186192 186192 0 0.0
.bss 76572 76572 0 0.0
.data 3360 3360 0 0.0
.rodata 85174 85174 0 0.0
.text 575196 575196 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 582998 582998 0 0.0
.app_xip_area 459960 459960 0 0.0
.bss 65640 65640 0 0.0
.data 728 728 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 588910 588910 0 0.0
.app_xip_area 461144 461144 0 0.0
.bss 70368 70368 0 0.0
.data 732 732 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 588738 588738 0 0.0
.app_xip_area 466516 466516 0 0.0
.bss 64880 64880 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read/write) 1088048 1088048 0 0.0
.bss 133276 133276 0 0.0
.data 2048 2048 0 0.0
.text 952704 952704 0 0.0
BRD4161A+rpc (read/write) 1142364 1142364 0 0.0
.bss 149956 149956 0 0.0
.data 2260 2260 0 0.0
.text 990128 990128 0 0.0
BRD4161A+rs911x (read/write) 973264 973264 0 0.0
.bss 161728 161728 0 0.0
.data 2048 2048 0 0.0
.text 809468 809468 0 0.0
lock-app BRD4161A+wf200 (read/write) 1127976 1127976 0 0.0
.bss 144360 144360 0 0.0
.data 2056 2056 0 0.0
.text 981540 981540 0 0.0
window-app BRD4161A (read/write) 1081524 1081524 0 0.0
.bss 134748 134748 0 0.0
.data 2076 2076 0 0.0
.text 944676 944676 0 0.0
esp32 all-clusters-app c3devkit (read only) 1022498 1022496 -2 -0.0
(read/write) 1486578 1486578 0 0.0
.dram0.bss 70288 70288 0 0.0
.dram0.data 14600 14600 0 0.0
.flash.rodata 216256 216256 0 0.0
.flash.text 1022498 1022496 -2 -0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1076131 1076131 0 0.0
(read/write) 488600 488600 0 0.0
.dram0.bss 75800 75800 0 0.0
.dram0.data 34144 34144 0 0.0
.flash.rodata 246660 246660 0 0.0
.flash.text 1070747 1070747 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w0+release (read/write) 641664 641664 0 0.0
.bss 69728 69728 0 0.0
.data 2028 2028 0 0.0
.text 567180 567180 0 0.0
lock k32w0+release (read/write) 698720 698720 0 0.0
.bss 70168 70168 0 0.0
.data 2036 2036 0 0.0
.text 623788 623788 0 0.0
linux all-clusters-app debug (read only) 2985793 2985793 0 0.0
(read/write) 155480 155480 0 0.0
.bss 61856 61856 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 85272 85272 0 0.0
.dynamic 608 608 0 0.0
.got 4568 4568 0 0.0
.init 27 27 0 0.0
.init_array 1072 1072 0 0.0
.rodata 268139 268139 0 0.0
.text 2539298 2539298 0 0.0
all-clusters-minimal-app debug (read only) 2828673 2828673 0 0.0
(read/write) 147184 147184 0 0.0
.bss 61056 61056 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 77864 77864 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 1064 1064 0 0.0
.rodata 268139 268139 0 0.0
.text 2384786 2384786 0 0.0
bridge-app debug+rpc (read only) 2343489 2343489 0 0.0
(read/write) 127056 127056 0 0.0
.bss 50144 50144 0 0.0
.data 3824 3824 0 0.0
.data.rel.ro 67304 67304 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 744 744 0 0.0
.rodata 200456 200456 0 0.0
.text 1980482 1980482 0 0.0
chip-tool debug (read only) 10414817 10414817 0 0.0
(read/write) 631088 631088 0 0.0
.bss 24824 24824 0 0.0
.data 3266 3266 0 0.0
.data.rel.ro 596592 596592 0 0.0
.dynamic 608 608 0 0.0
.got 5088 5088 0 0.0
.init 27 27 0 0.0
.init_array 656 656 0 0.0
.rodata 534325 534325 0 0.0
.text 8428916 8428916 0 0.0
chip-tool-ipv6only arm64 (read only) 9835828 9835828 0 0.0
(read/write) 678593 678593 0 0.0
.bss 32897 32897 0 0.0
.data 3272 3272 0 0.0
.data.rel.ro 623936 623936 0 0.0
.dynamic 560 560 0 0.0
.got 13536 13536 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 467972 467972 0 0.0
.text 7785556 7785556 0 0.0
lighting-app debug+rpc (read only) 2566577 2566577 0 0.0
(read/write) 129992 129992 0 0.0
.bss 49696 49696 0 0.0
.data 2096 2096 0 0.0
.data.rel.ro 72344 72344 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 832 832 0 0.0
.rodata 216080 216080 0 0.0
.text 2179858 2179858 0 0.0
lock-app debug (read only) 2531609 2531609 0 0.0
(read/write) 125040 125040 0 0.0
.bss 48096 48096 0 0.0
.data 1712 1712 0 0.0
.data.rel.ro 69352 69352 0 0.0
.dynamic 608 608 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 808 808 0 0.0
.rodata 231120 231120 0 0.0
.text 2134626 2134626 0 0.0
ota-provider-app debug (read only) 2335393 2335393 0 0.0
(read/write) 118840 118840 0 0.0
.bss 47744 47744 0 0.0
.data 1936 1936 0 0.0
.data.rel.ro 63336 63336 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 206136 206136 0 0.0
.text 1965810 1965810 0 0.0
ota-requestor-app debug (read only) 2460369 2460369 0 0.0
(read/write) 126200 126200 0 0.0
.bss 50112 50112 0 0.0
.data 2240 2240 0 0.0
.data.rel.ro 67992 67992 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 210112 210112 0 0.0
.text 2078194 2078194 0 0.0
shell debug (read only) 2569193 2569193 0 0.0
(read/write) 141632 141632 0 0.0
.bss 57704 57704 0 0.0
.data 1264 1264 0 0.0
.data.rel.ro 76944 76944 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 944 944 0 0.0
.rodata 230322 230322 0 0.0
.text 2181026 2181026 0 0.0
thermostat-no-ble arm64 (read only) 2341452 2341452 0 0.0
(read/write) 141393 141393 0 0.0
.bss 55297 55297 0 0.0
.data 1672 1672 0 0.0
.data.rel.ro 75672 75672 0 0.0
.dynamic 560 560 0 0.0
.got 4984 4984 0 0.0
.init 24 24 0 0.0
.init_array 400 400 0 0.0
.rodata 139588 139588 0 0.0
.text 1964816 1964816 0 0.0
tv-app debug (read only) 3116593 3116593 0 0.0
(read/write) 257224 257224 0 0.0
.bss 167160 167160 0 0.0
.data 4736 4736 0 0.0
.data.rel.ro 78888 78888 0 0.0
.dynamic 608 608 0 0.0
.got 4848 4848 0 0.0
.init 27 27 0 0.0
.init_array 968 968 0 0.0
.rodata 252168 252168 0 0.0
.text 2675714 2675714 0 0.0
tv-casting-app debug (read only) 5371545 5371545 0 0.0
(read/write) 158464 158464 0 0.0
.bss 51320 51320 0 0.0
.data 2432 2432 0 0.0
.data.rel.ro 98432 98432 0 0.0
.dynamic 608 608 0 0.0
.got 4736 4736 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 337249 337249 0 0.0
.text 4767506 4767506 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2449256 2449256 0 0.0
.bss 214508 214508 0 0.0
.data 5872 5872 0 0.0
.text 1411900 1411900 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1177131 1177131 0 0.0
bss 143132 143132 0 0.0
rodata 142660 142660 0 0.0
text 812416 812416 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1157199 1157199 0 0.0
bss 142368 142368 0 0.0
rodata 134192 134192 0 0.0
text 801732 801732 0 0.0
p6 all-clusters-app default (read only) 881568 881568 0 0.0
(read/write) 1687108 1687108 0 0.0
.bss 149128 149128 0 0.0
.data 2648 2648 0 0.0
.text 1526944 1526944 0 0.0
all-clusters-minimal-app default (read only) 882288 882288 0 0.0
(read/write) 1631228 1631228 0 0.0
.bss 148408 148408 0 0.0
.data 2648 2648 0 0.0
.text 1471784 1471784 0 0.0
light-app default (read only) 890592 890592 0 0.0
(read/write) 1551372 1551372 0 0.0
.bss 140312 140312 0 0.0
.data 2440 2440 0 0.0
.text 1400232 1400232 0 0.0
lock-app default (read only) 886120 886120 0 0.0
(read/write) 1588972 1588972 0 0.0
.bss 144768 144768 0 0.0
.data 2456 2456 0 0.0
.text 1433360 1433360 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 799564 799564 0 0.0
bss 70808 70808 0 0.0
noinit 40416 40416 0 0.0
text 567096 567096 0 0.0
lighting-app tlsr9518adk80d (read/write) 819672 819672 0 0.0
bss 71652 71652 0 0.0
noinit 40416 40416 0 0.0
text 583666 583670 4 0.0

@woody-apple woody-apple merged commit f89f9bf into sve Jul 29, 2022
@woody-apple woody-apple deleted the cherry-pick-e4916bb51260c926708e20723dd6ed9f44c8b6aa branch July 29, 2022 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants