module GirFFI::AllocationHelper

Helper module providing a safe allocation method that raises an exception if memory cannot be allocated.

Public Class Methods

safe_malloc(size) click to toggle source
# File lib/gir_ffi/allocation_helper.rb, line 7
def self.safe_malloc(size)
  ptr = LibC.malloc size
  raise NoMemoryError if ptr.null?
  ptr
end