π File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-22 08:33:57
π
/ (Root)
/
opt
/
alt
/
ruby30
/
share
/
ri
/
system
/
Fiddle
/
Pointer
π /opt/alt/ruby30/share/ri/system/Fiddle/Pointer
π Refresh
βοΈ
Editing: malloc-c.ri
Read Only
U:RDoc::AnyMethod[iI"malloc:ETI"Fiddle::Pointer::malloc;TT:privateo:RDoc::Markup::Document:@parts[ S:RDoc::Markup::Heading: leveli: textI" Examples;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"P# Automatically freeing the pointer when the block is exited - recommended ;TI"BFiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) do |pointer| ;TI" ... ;TI" end ;TI" ;TI"G# Manually freeing but relying on the garbage collector otherwise ;TI"?pointer = Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) ;TI" ... ;TI"pointer.call_free ;TI" ;TI"n# Relying on the garbage collector - may lead to unlimited memory allocated before freeing any, but safe ;TI"?pointer = Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) ;TI" ... ;TI" ;TI"# Only manually freeing ;TI",pointer = Fiddle::Pointer.malloc(size) ;TI"begin ;TI" ... ;TI"ensure ;TI" Fiddle.free pointer ;TI" end ;TI" ;TI"n# No free function and no call to free - the native memory will leak if the pointer is garbage collected ;TI",pointer = Fiddle::Pointer.malloc(size) ;TI" ... ;T:@format0o:RDoc::Markup::Paragraph; [I"GAllocate +size+ bytes of memory and associate it with an optional ;TI"+freefunc+.;T@ o;; [I"QIf a block is supplied, the pointer will be yielded to the block instead of ;TI"Kbeing returned, and the return value of the block will be returned. A ;TI"/+freefunc+ must be supplied if a block is.;T@ o;; [ I"MIf a +freefunc+ is supplied it will be called once, when the pointer is ;TI"Kgarbage collected or when the block is left if a block is supplied or ;TI"Rwhen the user calls +call_free+, whichever happens first. +freefunc+ must be ;TI"Lan address pointing to a function or an instance of +Fiddle::Function+.;T: @fileI"ext/fiddle/pointer.c;T:0@omit_headings_from_table_of_contents_below0I"οΏ½Fiddle::Pointer.malloc(size, freefunc = nil) => fiddle pointer instance Fiddle::Pointer.malloc(size, freefunc) { |pointer| ... } => ... ;T0[ I"(p1, p2 = v2);T@8FI"Pointer;TcRDoc::NormalClass00
πΎ Save Changes
β Cancel