Search
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (418 Bytes)
Bug #20718
» pointer_bug.rb
replication using ffi gem -
jcalvert (Jonathan Calvert)
, 09/06/2024 09:40 PM
require
'ffi'
require
'objspace'
require
'get_process_mem'
module
LibC
extend
FFI
::
Library
ffi_lib
FFI
::
Library
::
LIBC
attach_function
:malloc
,
[
:size_t
],
:pointer
attach_function
:free
,
[
:pointer
],
:void
end
10_000_000
.
times
do
buffer
=
LibC
.
malloc
100
buffer
.
write_string
(
"foo"
)
LibC
.
free
(
buffer
)
end
GC
.
start
puts
"GC stats"
puts
GC
.
stat
puts
"-------------"
puts
"memsize:
#{
GetProcessMem
.
new
.
mb
}
Mb"
« Previous
1
2
Next »
(1-1/2)
Loading...