Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0.RC2
Assignee: Unassigned
Components: Core Classes/Modules
Created: 17/Oct/12 1:29 PM
Description:

JVM exits with an error after doing a series of malloc & free calls.

This program illustrates the problem.

require 'rubygems'
require 'ffi'

module LibC
extend FFI::Library
library = ffi_lib(FFI::Library::LIBC).first

attach_function :malloc, [:size_t], :pointer
attach_function :free, [:pointer], :void
end # module LibC

def blowup(string)
pointer = LibC.malloc(string.size)
pointer.write_string(string)

  1. call to #free causes jvm to exit
    LibC.free(pointer)
    end

1_000.times do |i|
string = 'a' * i
print "#{i}, "
blowup(string)
end

jruby z.rb
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, java(28463,0x100601000) malloc: *** error for object 0x101a2b320: incorrect checksum for freed object - object was probably modified after being freed.

      • set a breakpoint in malloc_error_break to debug
        Abort trap
Environment: OSX 10.6.8, 64-bit JVM 1.6.0_33
Project: JRuby
Labels: ffi
Priority: Major Major
Reporter: Chuck Remes
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to