Class: MemoryLocker

Inherits:
Object
  • Object
show all
Defined in:
lib/memory_locker.rb,
lib/memory_locker/glibc.rb,
lib/memory_locker/version.rb

Overview

Lock process memory, so it won’t be swapped by the kernel. It is implemented as a one-way operation: there is no unlock. That’s because it’s hard to properly clean memory in Ruby.

Defined Under Namespace

Modules: Backend

Constant Summary collapse

LockingError =
Class.new StandardError
VERSION =
'0.1.0'

Instance Method Summary collapse

Instance Method Details

#lock!Object



12
13
14
# File 'lib/memory_locker.rb', line 12

def lock!
  Backend.lock! || raise(LockingError, "Failed to lock memory, errno #{FFI.errno}")
end