Class: AutoC::BDWAllocator
- Inherits:
-
Object
- Object
- AutoC::BDWAllocator
- Includes:
- Entity, Singleton
- Defined in:
- lib/autoc/allocators.rb
Overview
Boehm-Demers-Weiser garbage-collecting memory handler www.hboehm.info/gc/
Constant Summary
Constants included from Entity
Instance Method Summary collapse
- #allocate(type, count = 1, atomic: false, **kws) ⇒ Object
- #free(pointer) ⇒ Object
-
#initialize ⇒ BDWAllocator
constructor
A new instance of BDWAllocator.
Methods included from Entity
#<=>, #complexity, #dependencies, #forward_declarations, #implementation, #interface, #position, #references, #total_dependencies, #total_references
Constructor Details
#initialize ⇒ BDWAllocator
Returns a new instance of BDWAllocator.
40 |
# File 'lib/autoc/allocators.rb', line 40 def initialize = dependencies << SystemHeader.new('gc.h') |
Instance Method Details
#allocate(type, count = 1, atomic: false, **kws) ⇒ Object
42 43 44 |
# 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) ⇒ Object
46 |
# File 'lib/autoc/allocators.rb', line 46 def free(pointer) = nil |