Skip to content

Comments

Track managed array pinning in Mat#1691

Merged
shimat merged 1 commit intoshimat:mainfrom
Lillenne:main
Aug 18, 2024
Merged

Track managed array pinning in Mat#1691
shimat merged 1 commit intoshimat:mainfrom
Lillenne:main

Conversation

@Lillenne
Copy link
Contributor

@Lillenne Lillenne commented Aug 9, 2024

Rationale

Addresses issue #1689 (detailed description there).

Managed arrays are unpinned when the original Mat is disposed or finalized. Captured submat data pointers are not updated on subsequent GC compaction, causing bad data access or AccessViolationExceptions.

Changes

Track GCHandles in the Mat class (via helper class ArrayPinningLifeTime) instead of allowing the DisposeableObject parent class to unpin it when the parent Mat is cleaned up.

Fix #1689

@shimat
Copy link
Owner

shimat commented Aug 18, 2024

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mat from managed array unpinned while submats exist

2 participants