Commit ba16dce
committed
Free the env instance-data block at teardown; fix module-disposable dedup and failed managed-init leak
- FinalizeInstanceData frees the per-env instance-data block once the last context on the env is disposed, instead of retaining it for the process lifetime; a host context's disposal cascades synchronously to the other slot, and the block is not nulled via napi_set_instance_data (that would double-free Node's finalizer record). Updates runtime-model.md.
- AddModuleDisposable deduplicates by reference identity rather than Equals, so equal-but-distinct IDisposable module instances are each disposed once. Adds a regression test.
- ManagedHost disposes its JSRuntimeContext on the failed-initialization path so its instance-data GCHandle, synchronization context, and resolve handlers are released when no teardown handshake was established.1 parent 65ec52e commit ba16dce
4 files changed
Lines changed: 85 additions & 19 deletions
File tree
- docs/concepts
- src
- NodeApi.DotNetHost
- NodeApi/Interop
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
124 | | - | |
125 | | - | |
126 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
259 | 269 | | |
260 | 270 | | |
261 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
| 275 | + | |
| 276 | + | |
278 | 277 | | |
279 | 278 | | |
280 | 279 | | |
| |||
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 308 | + | |
312 | 309 | | |
313 | 310 | | |
314 | 311 | | |
| |||
321 | 318 | | |
322 | 319 | | |
323 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
324 | 335 | | |
325 | 336 | | |
326 | 337 | | |
| |||
912 | 923 | | |
913 | 924 | | |
914 | 925 | | |
915 | | - | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
916 | 930 | | |
917 | | - | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
918 | 935 | | |
| 936 | + | |
| 937 | + | |
919 | 938 | | |
920 | 939 | | |
921 | 940 | | |
| |||
969 | 988 | | |
970 | 989 | | |
971 | 990 | | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
976 | 994 | | |
977 | 995 | | |
978 | 996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
149 | 183 | | |
150 | 184 | | |
151 | 185 | | |
| |||
0 commit comments