@@ -1614,12 +1614,17 @@ export default function makeKernelKeeper(
16141614 // leaving work for the next delivery.
16151615
16161616 function processRefcounts ( ) {
1617+ const lostObjects = [ ] ;
16171618 if ( enableKernelGC ) {
16181619 const actions = new Set ( ) ;
16191620 for ( const kref of maybeFreeKrefs . values ( ) ) {
16201621 const { type } = parseKernelSlot ( kref ) ;
16211622 if ( type === 'promise' ) {
16221623 const kpid = kref ;
1624+ if ( ! hasKernelPromise ( kpid ) ) {
1625+ lostObjects . push ( kref ) ;
1626+ continue ;
1627+ }
16231628 const kp = getKernelPromise ( kpid ) ;
16241629 if ( kp . refCount === 0 ) {
16251630 let idx = 0 ;
@@ -1645,6 +1650,9 @@ export default function makeKernelKeeper(
16451650 // deleted). Message delivery should use that, but not us.
16461651 const ownerKey = `${ kref } .owner` ;
16471652 let ownerVatID = kvStore . get ( ownerKey ) ;
1653+ if ( ! ownerVatID ) {
1654+ lostObjects . push ( kref ) ;
1655+ }
16481656 const terminated = terminatedVats . includes ( ownerVatID ) ;
16491657
16501658 // Some objects that are still owned, but the owning vat
@@ -1706,6 +1714,7 @@ export default function makeKernelKeeper(
17061714 addGCActions ( [ ...actions ] ) ;
17071715 }
17081716 maybeFreeKrefs . clear ( ) ;
1717+ return { lostObjects } ;
17091718 }
17101719
17111720 function createVatState ( vatID , source , options ) {
0 commit comments