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

[Android] Keep GetConnectedDeviceCallbackJni from being deleted early #14772

Merged
merged 1 commit into from
Feb 5, 2022

Conversation

austinh0
Copy link
Contributor

@austinh0 austinh0 commented Feb 4, 2022

Problem

  • Native callback for getting a connected device needs to hold a reference to both GetConnectedDeviceCallbackJni and GetConnectedDeviceCallbackJni jobjects, or else GetConnectedDeviceCallbackJni could be gc'd too early.

Change overview

  • Hold GetConnectedDeviceCallbackJni reference, delete it when callback returns.

Testing

  • Triggered manual GC before callback returned and Java object was not finalized. Triggered manual GC after callback returned and Java object was finalized.

@github-actions
Copy link

github-actions bot commented Feb 4, 2022

PR #14772: Size comparison from 44c2895 to 507abb5

Full report (34 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 44c2895 507abb5 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 587130 587130 0 0.0
.app_xip_area 493728 493728 0 0.0
.bss 76124 76124 0 0.0
.data 624 624 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 545046 545046 0 0.0
.app_xip_area 453204 453204 0 0.0
.bss 74596 74596 0 0.0
.data 588 588 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor cyw930739m2evb_01 (read/write) 569418 569418 0 0.0
.app_xip_area 468256 468256 0 0.0
.bss 83588 83588 0 0.0
.data 532 532 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 856792 856792 0 0.0
(read/write) 125888 125888 0 0.0
.bss 123960 123960 0 0.0
.data 1924 1924 0 0.0
.text 856784 856784 0 0.0
BRD4161A+rpc (read only) 844168 844168 0 0.0
(read/write) 142544 142544 0 0.0
.bss 140520 140520 0 0.0
.data 2024 2024 0 0.0
.text 844160 844160 0 0.0
window-app BRD4161A (read only) 829012 829012 0 0.0
(read/write) 124524 124524 0 0.0
.bss 122644 122644 0 0.0
.data 1880 1880 0 0.0
.text 829004 829004 0 0.0
esp32 all-clusters-app c3devkit (read only) 935314 935314 0 0.0
(read/write) 1401162 1401162 0 0.0
.dram0.bss 70056 70056 0 0.0
.dram0.data 14276 14276 0 0.0
.flash.rodata 197920 197920 0 0.0
.flash.text 935314 935314 0 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 983359 983359 0 0.0
(read/write) 465516 465516 0 0.0
.dram0.bss 74816 74816 0 0.0
.dram0.data 34040 34040 0 0.0
.flash.rodata 224532 224532 0 0.0
.flash.text 977975 977975 0 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 671632 671632 0 0.0
.bss 75828 75828 0 0.0
.data 1884 1884 0 0.0
.text 588120 588120 0 0.0
lock k32w061+release (read/write) 673220 673220 0 0.0
.bss 76148 76148 0 0.0
.data 1924 1924 0 0.0
.text 589348 589348 0 0.0
linux chip-tool-ipv6only arm64 (read only) 7171332 7171332 0 0.0
(read/write) 283441 283441 0 0.0
.bss 47457 47457 0 0.0
.data 1128 1128 0 0.0
.data.rel.ro 185656 185656 0 0.0
.dynamic 560 560 0 0.0
.got 45424 45424 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 390508 390508 0 0.0
.text 6179092 6179092 0 0.0
thermostat-no-ble arm64 (read only) 2125964 2125964 0 0.0
(read/write) 140785 140785 0 0.0
.bss 57745 57745 0 0.0
.data 976 976 0 0.0
.data.rel.ro 74928 74928 0 0.0
.dynamic 560 560 0 0.0
.got 4160 4160 0 0.0
.init 24 24 0 0.0
.init_array 336 336 0 0.0
.rodata 131292 131292 0 0.0
.text 1776528 1776528 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2386968 2386968 0 0.0
.bss 188964 188964 0 0.0
.data 5296 5296 0 0.0
.text 1349568 1349568 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2347552 2347552 0 0.0
.bss 181072 181072 0 0.0
.data 5600 5600 0 0.0
.text 1310152 1310152 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2311552 2311552 0 0.0
.bss 180960 180960 0 0.0
.data 5584 5584 0 0.0
.text 1274152 1274152 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2301820 2301820 0 0.0
.bss 178244 178244 0 0.0
.data 5400 5400 0 0.0
.text 1264392 1264392 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 997587 997587 0 0.0
bss 120540 120540 0 0.0
rodata 117184 117184 0 0.0
text 680948 680948 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 979439 979439 0 0.0
bss 116396 116396 0 0.0
rodata 108572 108572 0 0.0
text 676000 676000 0 0.0
nrf52840dongle_nrf52840 (read/write) 1014275 1014275 0 0.0
bss 121904 121904 0 0.0
rodata 116020 116020 0 0.0
text 686440 686440 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 904278 904278 0 0.0
bss 117104 117104 0 0.0
rodata 110440 110440 0 0.0
text 595960 595960 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 929727 929727 0 0.0
bss 118880 118880 0 0.0
rodata 105532 105532 0 0.0
text 626808 626808 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 837254 837254 0 0.0
bss 115472 115472 0 0.0
rodata 98704 98704 0 0.0
text 542596 542596 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541779 541779 0 0.0
bss 52588 52588 0 0.0
rodata 50048 50048 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 932343 932343 0 0.0
bss 118632 118632 0 0.0
rodata 106004 106004 0 0.0
text 629144 629144 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 927299 927299 0 0.0
bss 118632 118632 0 0.0
rodata 105008 105008 0 0.0
text 625084 625084 0 0.0
shell nrf52840dk_nrf52840 (read/write) 802571 802571 0 0.0
bss 110968 110968 0 0.0
rodata 78480 78480 0 0.0
text 535544 535544 0 0.0
p6 all-clusters-app default (read/write) 2448200 2448200 0 0.0
.bss 117124 117124 0 0.0
.data 2584 2584 0 0.0
.text 1406464 1406464 0 0.0
light-app default (read/write) 2353104 2353104 0 0.0
.bss 106268 106268 0 0.0
.data 2432 2432 0 0.0
.text 1311368 1311368 0 0.0
lock-app default (read/write) 2318288 2318288 0 0.0
.bss 105980 105980 0 0.0
.data 2392 2392 0 0.0
.text 1276552 1276552 0 0.0
qpg lighting-app qpg6105+debug (read only) 579900 579900 0 0.0
(read/write) 146940 146940 0 0.0
.bss 88120 88120 0 0.0
.data 1088 1088 0 0.0
.text 574580 574580 0 0.0
lock-app qpg6105+debug (read only) 525972 525972 0 0.0
(read/write) 146940 146940 0 0.0
.bss 87560 87560 0 0.0
.data 1024 1024 0 0.0
.text 520652 520652 0 0.0
persistent-storage-app qpg6105+debug (read only) 107140 107140 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38504 38504 0 0.0
.data 288 288 0 0.0
.text 101820 101820 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 858826 858826 0 0.0
bss 88476 88476 0 0.0
noinit 37160 37160 0 0.0
text 601994 601994 0 0.0

@github-actions
Copy link

github-actions bot commented Feb 4, 2022

PR #14772: Size comparison from b58dc83 to ae24600

Full report (43 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section b58dc83 ae24600 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 587614 587614 0 0.0
.app_xip_area 494212 494212 0 0.0
.bss 76124 76124 0 0.0
.data 624 624 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 545538 545538 0 0.0
.app_xip_area 453688 453688 0 0.0
.bss 74604 74604 0 0.0
.data 588 588 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor cyw930739m2evb_01 (read/write) 569934 569934 0 0.0
.app_xip_area 468772 468772 0 0.0
.bss 83588 83588 0 0.0
.data 532 532 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 857248 857248 0 0.0
(read/write) 125888 125888 0 0.0
.bss 123960 123960 0 0.0
.data 1924 1924 0 0.0
.text 857240 857240 0 0.0
BRD4161A+rpc (read only) 844616 844616 0 0.0
(read/write) 142544 142544 0 0.0
.bss 140520 140520 0 0.0
.data 2024 2024 0 0.0
.text 844608 844608 0 0.0
window-app BRD4161A (read only) 829484 829484 0 0.0
(read/write) 124528 124528 0 0.0
.bss 122648 122648 0 0.0
.data 1880 1880 0 0.0
.text 829476 829476 0 0.0
esp32 all-clusters-app c3devkit (read only) 936818 936818 0 0.0
(read/write) 1401186 1401186 0 0.0
.dram0.bss 70064 70064 0 0.0
.dram0.data 14276 14276 0 0.0
.flash.rodata 197944 197944 0 0.0
.flash.text 936818 936818 0 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 984795 984795 0 0.0
(read/write) 465536 465536 0 0.0
.dram0.bss 74816 74816 0 0.0
.dram0.data 34040 34040 0 0.0
.flash.rodata 224552 224552 0 0.0
.flash.text 979411 979411 0 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 672140 672140 0 0.0
.bss 75832 75832 0 0.0
.data 1884 1884 0 0.0
.text 588624 588624 0 0.0
lock k32w061+release (read/write) 673704 673704 0 0.0
.bss 76160 76160 0 0.0
.data 1924 1924 0 0.0
.text 589820 589820 0 0.0
linux all-clusters-app debug (read only) 2323425 2323425 0 0.0
(read/write) 140032 140032 0 0.0
.bss 54656 54656 0 0.0
.data 1200 1200 0 0.0
.data.rel.ro 78504 78504 0 0.0
.dynamic 592 592 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 204197 204197 0 0.0
.text 1957026 1957026 0 0.0
bridge-app debug+rpc (read only) 1699973 1699973 0 0.0
(read/write) 84504 84504 0 0.0
.bss 39264 39264 0 0.0
.data 1986 1986 0 0.0
.data.rel.ro 38088 38088 0 0.0
.dynamic 592 592 0 0.0
.got 3976 3976 0 0.0
.init 27 27 0 0.0
.init_array 560 560 0 0.0
.rodata 139476 139476 0 0.0
.text 1444069 1444069 0 0.0
chip-tool debug (read only) 7297349 7297349 0 0.0
(read/write) 184528 184528 0 0.0
.bss 32360 32360 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 145024 145024 0 0.0
.dynamic 608 608 0 0.0
.got 4760 4760 0 0.0
.init 27 27 0 0.0
.init_array 608 608 0 0.0
.rodata 410165 410165 0 0.0
.text 6517317 6517317 0 0.0
chip-tool-ipv6only arm64 (read only) 7237668 7237668 0 0.0
(read/write) 287873 287873 0 0.0
.bss 50641 50641 0 0.0
.data 1176 1176 0 0.0
.data.rel.ro 186488 186488 0 0.0
.dynamic 560 560 0 0.0
.got 45776 45776 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 392684 392684 0 0.0
.text 6240244 6240244 0 0.0
door-lock-app debug (read only) 1904009 1904009 0 0.0
(read/write) 110760 110760 0 0.0
.bss 42272 42272 0 0.0
.data 962 962 0 0.0
.data.rel.ro 62088 62088 0 0.0
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 171996 171996 0 0.0
.text 1583618 1583618 0 0.0
lighting-app debug+rpc (read only) 1998817 1998817 0 0.0
(read/write) 115784 115784 0 0.0
.bss 43256 43256 0 0.0
.data 1384 1384 0 0.0
.data.rel.ro 65640 65640 0 0.0
.dynamic 608 608 0 0.0
.got 4144 4144 0 0.0
.init 27 27 0 0.0
.init_array 712 712 0 0.0
.rodata 162097 162097 0 0.0
.text 1682194 1682194 0 0.0
ota-provider-app debug (read only) 1708073 1708073 0 0.0
(read/write) 81400 81400 0 0.0
.bss 41248 41248 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 33528 33528 0 0.0
.dynamic 608 608 0 0.0
.got 4248 4248 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 150054 150054 0 0.0
.text 1439442 1439442 0 0.0
ota-requestor-app debug (read only) 1699505 1699505 0 0.0
(read/write) 83448 83448 0 0.0
.bss 42432 42432 0 0.0
.data 1128 1128 0 0.0
.data.rel.ro 34584 34584 0 0.0
.dynamic 592 592 0 0.0
.got 4040 4040 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 144535 144535 0 0.0
.text 1438194 1438194 0 0.0
shell debug (read only) 2297481 2297481 0 0.0
(read/write) 141552 141552 0 0.0
.bss 62016 62016 0 0.0
.data 800 800 0 0.0
.data.rel.ro 73040 73040 0 0.0
.dynamic 592 592 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 904 904 0 0.0
.rodata 205074 205074 0 0.0
.text 1935986 1935986 0 0.0
thermostat-no-ble arm64 (read only) 2126276 2126276 0 0.0
(read/write) 140705 140705 0 0.0
.bss 57745 57745 0 0.0
.data 968 968 0 0.0
.data.rel.ro 74872 74872 0 0.0
.dynamic 560 560 0 0.0
.got 4152 4152 0 0.0
.init 24 24 0 0.0
.init_array 328 328 0 0.0
.rodata 131220 131220 0 0.0
.text 1777104 1777104 0 0.0
tv-app debug (read only) 2517937 2517937 0 0.0
(read/write) 139704 139704 0 0.0
.bss 57280 57280 0 0.0
.data 3168 3168 0 0.0
.data.rel.ro 73224 73224 0 0.0
.dynamic 592 592 0 0.0
.got 4528 4528 0 0.0
.init 27 27 0 0.0
.init_array 880 880 0 0.0
.rodata 193492 193492 0 0.0
.text 2151410 2151410 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2388824 2388824 0 0.0
.bss 188972 188972 0 0.0
.data 5296 5296 0 0.0
.text 1351424 1351424 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2348016 2348016 0 0.0
.bss 181072 181072 0 0.0
.data 5600 5600 0 0.0
.text 1310616 1310616 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2312000 2312000 0 0.0
.bss 180960 180960 0 0.0
.data 5584 5584 0 0.0
.text 1274600 1274600 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2302340 2302340 0 0.0
.bss 178244 178244 0 0.0
.data 5400 5400 0 0.0
.text 1264912 1264912 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 998055 998055 0 0.0
bss 120544 120544 0 0.0
rodata 117252 117252 0 0.0
text 681356 681356 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 969411 969411 0 0.0
bss 116400 116400 0 0.0
rodata 108640 108640 0 0.0
text 665916 665916 0 0.0
nrf52840dongle_nrf52840 (read/write) 1014747 1014747 0 0.0
bss 121908 121908 0 0.0
rodata 116092 116092 0 0.0
text 686852 686852 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 904750 904750 0 0.0
bss 117108 117108 0 0.0
rodata 110512 110512 0 0.0
text 596372 596372 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 930199 930199 0 0.0
bss 118884 118884 0 0.0
rodata 105604 105604 0 0.0
text 627216 627216 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 837722 837722 0 0.0
bss 115476 115476 0 0.0
rodata 98772 98772 0 0.0
text 543004 543004 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541779 541779 0 0.0
bss 52588 52588 0 0.0
rodata 50048 50048 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 932827 932827 0 0.0
bss 118636 118636 0 0.0
rodata 106072 106072 0 0.0
text 629556 629556 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 927783 927783 0 0.0
bss 118636 118636 0 0.0
rodata 105076 105076 0 0.0
text 625496 625496 0 0.0
shell nrf52840dk_nrf52840 (read/write) 802779 802779 0 0.0
bss 110968 110968 0 0.0
rodata 78480 78480 0 0.0
text 535760 535760 0 0.0
p6 all-clusters-app default (read/write) 2450072 2450072 0 0.0
.bss 117128 117128 0 0.0
.data 2584 2584 0 0.0
.text 1408336 1408336 0 0.0
light-app default (read/write) 2353488 2353488 0 0.0
.bss 106272 106272 0 0.0
.data 2432 2432 0 0.0
.text 1311752 1311752 0 0.0
lock-app default (read/write) 2318712 2318712 0 0.0
.bss 105992 105992 0 0.0
.data 2392 2392 0 0.0
.text 1276976 1276976 0 0.0
qpg lighting-app qpg6105+debug (read only) 580288 580288 0 0.0
(read/write) 146940 146940 0 0.0
.bss 88112 88112 0 0.0
.data 1088 1088 0 0.0
.text 574968 574968 0 0.0
lock-app qpg6105+debug (read only) 526368 526368 0 0.0
(read/write) 146940 146940 0 0.0
.bss 87560 87560 0 0.0
.data 1024 1024 0 0.0
.text 521048 521048 0 0.0
persistent-storage-app qpg6105+debug (read only) 107140 107140 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38504 38504 0 0.0
.data 288 288 0 0.0
.text 101820 101820 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 859086 859086 0 0.0
bss 88476 88476 0 0.0
noinit 37160 37160 0 0.0
text 602070 602070 0 0.0

@andy31415 andy31415 merged commit 1cf1bec into project-chip:master Feb 5, 2022
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