Differences From Artifact [800160da50]:
- File
src/OFSecureData.m
— part of check-in
[e629dc83a9]
at
2019-12-27 00:41:54
on branch trunk
— OFSecureData: Add allowsSwappableMemory property
With this property, it's possible to specify whether the memory should
be protected from swapping or not. This makes it easier for e.g. the
crypto hash classes: They can now just always use OFSecureData without
wasting unswappable memory if it's not needed. (user: js, size: 14543) [annotate] [blame] [check-ins using]
To Artifact [4f8dc33f67]:
- File src/OFSecureData.m — part of check-in [d5c4dedada] at 2019-12-27 21:43:19 on branch trunk — OFSecureData: Fix #ifdefs (user: js, size: 14698) [annotate] [blame] [check-ins using]
︙ | |||
256 257 258 259 260 261 262 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | + - + | of_bitset_clear(page->map, chunkIndex + i); } #endif @implementation OFSecureData @synthesize allowsSwappableMemory = _allowsSwappableMemory; #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) && \ |
︙ | |||
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | + + + - | - (instancetype)initWithItemSize: (size_t)itemSize count: (size_t)count allowsSwappableMemory: (bool)allowsSwappableMemory { self = [super init]; @try { #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) size_t pageSize = [OFSystemInfo pageSize]; #endif if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; if (allowsSwappableMemory) { _items = [self allocMemoryWithSize: itemSize count: count]; memset(_items, 0, count * itemSize); #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) } else if (count * itemSize >= pageSize) _items = mapPages(OF_ROUND_UP_POW2(pageSize, count * itemSize) / pageSize); else { |
︙ | |||
428 429 430 431 432 433 434 435 436 437 438 439 | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | + + - | count * itemSize); if (_items == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: count * itemSize]; } } #else } else @throw [OFNotImplementedException exceptionWithSelector: _cmd object: nil]; #endif |
︙ |