Commit ebf7896
Fix incorrect Hailo reference counting and virtual device reuse
Previously, TARGET_REF_COUNT was only incremented during the first virtual device allocation,
but not for additional model instances. This caused the VDevice to be deallocated prematurely
when multiple models were loaded, as each model called close() and decremented the count.
Additionally, TARGET was not reset to None after releasing the virtual device, which caused
reuse of a released virtual device and raised exceptions on subsequent model creation.
This commit moves the TARGET_REF_COUNT increment outside the allocation block,
and resets TARGET to None after the virtual device is released when the count reaches zero.
Addresses #1300
Signed-off-by: Florent Gastoud (main) <[email protected]>1 parent 46fa351 commit ebf7896
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
0 commit comments