YAML custom load: Segmentation faults

Discussion in 'Ruby' started by Kaspar Schiess, Jun 25, 2004.

  1. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hello all,

    using ruby 1.8.1 (2003-12-25) [i386-mingw32], I get segmentation faults
    using YAML to deserialize a class of my own. The class is registered as
    a domain type in YAML called !tua.ch,2004/ai/neural. (Yes it is a remake
    of LibNeural).

    Here's the deserialization code; I would like to know if I am doing
    something conceptually wrong or if its just YAML who's crashing because
    of a bug when not using objectmaker:

    - --------------------------------------
    YAML::add_domain_type(AI::NeuralNet::YAMLDOMAIN,
    AI::NeuralNet::YAMLLOCATION) do |type, val|
    ~ net = AI::NeuralNet.new( *val['sizes'] )

    ~ o = val['output']
    ~ o.each_with_index do |w, i|
    net.set_weights(AI::NeuralNet::LAYER_OUTPUT, i, w)
    ~ end

    ~ h = val['hidden']
    ~ h.each_with_index do |w, i|
    ~ net.set_weights(AI::NeuralNet::LAYER_HIDDEN, i, w)
    ~ end

    ~ net
    end
    - ---------------------------------------

    Note that the YAML.load call returns an object of type AI::NeuralNet
    with the correct dimensions and weights, but once I try to call into the
    object, I get a

    /lib/data/set.rb:158: [BUG] rb_gc_mark(): unknown data type
    0x0(0x2a14698) non object
    ruby 1.8.1 (2003-12-25) [i386-mingw32]

    I guess the exact location of the bug is not important, because that is
    just the point the garbage collection kicks in.

    I am getting rather desperate, and I will have to abolish YAML later in
    the day to finish my work here, but any suggestions on making YAML work
    are welcome.


    Best regards,
    kaspar

    semantics & semiotics
    code manufacture

    www.tua.ch/ruby
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (MingW32)
    Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

    iD8DBQFA3AKKFifl4CA0ImQRAoL9AJ950AckTZbclIrkYmXn+rpW7D7mgQCgq4S2
    5rUrc/tMmyNzD7/abT7L2kI=
    =MJgv
    -----END PGP SIGNATURE-----
     
    Kaspar Schiess, Jun 25, 2004
    #1
    1. Advertising

  2. Kaspar Schiess

    ts Guest

    >>>>> "K" == Kaspar Schiess <> writes:

    K> /lib/data/set.rb:158: [BUG] rb_gc_mark(): unknown data type
    K> 0x0(0x2a14698) non object
    K> ruby 1.8.1 (2003-12-25) [i386-mingw32]

    K> I guess the exact location of the bug is not important, because that is
    K> just the point the garbage collection kicks in.

    No, it's important.

    try to use a recent version of YAML and Syck from CVS


    Guy Decoux
     
    ts, Jun 25, 2004
    #2
    1. Advertising

  3. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    ts wrote:

    |>>>>>"K" == Kaspar Schiess <> writes:
    |
    |
    | K> /lib/data/set.rb:158: [BUG] rb_gc_mark(): unknown data type
    | K> 0x0(0x2a14698) non object
    | K> ruby 1.8.1 (2003-12-25) [i386-mingw32]
    |
    | K> I guess the exact location of the bug is not important, because that is
    | K> just the point the garbage collection kicks in.
    |
    | No, it's important.
    |
    | try to use a recent version of YAML and Syck from CVS
    |
    |
    | Guy Decoux

    I did, but the problem stayed: Then I checked my code and the error was
    there. So sorry for the detour and thank you for replying.

    Nice side-effect is that I have the newest syck installed ;)

    Yours,
    kaspar

    semantics & semiotics
    code manufacture

    www.tua.ch/ruby
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (MingW32)
    Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

    iD8DBQFA3CNCFifl4CA0ImQRAjxHAKCRsfmFBQWgzrKeQ1yI14XaGUrn1wCeI7ix
    ldrP6C1MMokMH8pmQgti3nY=
    =01qK
    -----END PGP SIGNATURE-----
     
    Kaspar Schiess, Jun 25, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mathias

    Segmentation faults using threads

    Mathias, Feb 13, 2007, in forum: Python
    Replies:
    8
    Views:
    327
    John Nagle
    Feb 14, 2007
  2. Stanley S
    Replies:
    16
    Views:
    2,554
    Keith Thompson
    Dec 22, 2005
  3. Digital Puer
    Replies:
    18
    Views:
    766
    Ron Natalie
    Dec 28, 2005
  4. ZillionDollarSadist

    Segmentation faults on "new"

    ZillionDollarSadist, Jan 17, 2007, in forum: C++
    Replies:
    6
    Views:
    373
    Jacek Dziedzic
    Jan 18, 2007
  5. Paul Battley

    YAML.dump/YAML.load bug

    Paul Battley, Aug 3, 2005, in forum: Ruby
    Replies:
    0
    Views:
    194
    Paul Battley
    Aug 3, 2005
Loading...

Share This Page