Skip to content

Conversation

@amtelekom
Copy link
Contributor

Hi,

the current CryptoVec implementation on Windows unlocks memory pages too early if the backing stores of multiple CryptoVecs are located in the same page.

This is because VirtualLock/Unlock do not implement reference-counting on the OS side:

This function is not like the GlobalLock or LocalLock function in that it does not increment a lock count and translate a handle into a pointer. There is no lock count for virtual pages, so multiple calls to the VirtualUnlock function are never required to unlock a region of pages.

This PR adds userspace lock counting, so only once the last CryptoVec has released it's memory from a Page, the Page is unlocked.

@Eugeny
Copy link
Owner

Eugeny commented Feb 25, 2025

Looking good now - thank you!

@Eugeny Eugeny merged commit 0665aac into Eugeny:main Feb 25, 2025
7 checks passed
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.

2 participants