문제

Somehow we got a LOT of ReaderWriterLockSlim in our code. Each of them takes 6K memory, so this has become a big issue.

As a quick fix, I'm looking for a less memory-hungry replacement. I'm trying a Joe Duffy's RW-lock, but it's not upgradeable and write-recursive (and is pretty hard to make it such).

Is there any other, more memory-light replacement?

도움이 되었습니까?

해결책

Well, an obvious approach would be to use ReadWriterLock (sans Slim), which I believe is less memory intensive (but also less efficient in some scenarios).

다른 팁

In case someone else needs a memory-lighter RW lock with the same semantics as ReaderWriterLockSlim:

  • upgradeable;
  • recursive;
  • lock belongs to a thread, so, for instance, recursive W-locks are OK, or R-lock from inside W-lock is OK;

the one from Mono source should be OK.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top