What is segmentation fault in ruby

when am using ruby1.8.7 Patch-level 174 am get segmentation fault in my
application can any one explain me what is segmentation fault and how it
can be resolved.

Regards
Udhaya Kumar.D

Udhaya Kumar wrote in post #1007362:

when am using ruby1.8.7 Patch-level 174 am get segmentation fault in my
application can any one explain me what is segmentation fault and how it
can be resolved.

It’s a machine-code level bug, either in ruby itself, or in the compiler
you used to build ruby, or in one of the C extensions you’re using with
ruby.

So:

  • what OS are you on?
  • where did you get ruby from? a package? built yourself? (if so how,
    with what flags?)
  • what C extensions are you using? (this includes gems which report
    “native extensions” when they are installing)
  • what does your ruby application do when the bug is triggered?
  • can you get a backtrace? To do this, run ruby under gdb, and then do
    whatever you do to make it crash.

$ gdb ruby

(gdb) run [args]

[when it crashes]
(gdb) bt

That is, if you’d do
ruby myscript.rb
then instead do
gdb ruby
run myscript.rb

That info should help narrow down the problem. You’re using a pretty
robust version of ruby, so it’s unlikely to be a bug in ruby itself, but
it is possible.

From Wikipedia:

“Generally, segmentation faults occur because: a pointer is either NULL,
points to random memory (probably never initialized to anything), or
points to memory that has been freed/deallocated/“deleted”.”

Some element of your system is doing something the author didn’t expect
to happen.