class AutoC::Allocator::BDWAllocator

Boehm-Demers-Weiser garbage-collecting memory handler www.hboehm.info/gc/

Public Class Methods

new(= dependencies << SystemHeader.new('gc.h')) click to toggle source
# File lib/autoc/allocators.rb, line 40
    def initialize = dependencies << SystemHeader.new('gc.h')

    def allocate(type, count = 1, atomic: false, **kws)
      atomic ? "(#{type}*)GC_malloc_atomic((#{count})*sizeof(#{type}))" : "(#{type}*)GC_malloc((#{count})*sizeof(#{type}))"
    end

    def free(pointer) = nil

  end # Allocator


end

Public Instance Methods

allocate(type, count = 1, atomic: false, **kws) click to toggle source
# File lib/autoc/allocators.rb, line 42
def allocate(type, count = 1, atomic: false, **kws)
  atomic ? "(#{type}*)GC_malloc_atomic((#{count})*sizeof(#{type}))" : "(#{type}*)GC_malloc((#{count})*sizeof(#{type}))"
end
free(pointer) click to toggle source
# File lib/autoc/allocators.rb, line 46
  def free(pointer) = nil

end