kevin_i_orourke has asked for the wisdom of the Perl Monks concerning the following question:

I've recently started work on a project I mentioned in binutils-style module (or: XS interface to BFD), which involves running h2xs on a header files to autogenerate as much as I could (using the -x flag).

When I tried this on bfd.h from the binutils distribution h2xs churns away creating a typemap file, gradually sucking up all the available physical memory (256M), then all the swap (256M) before being killed.

Would this be regarded as normal or does it point to something going horrifically wrong with h2xs? If h2xs just needs a bit more memory I have a spare 6Gb partition which I could temporarily make into swap space.

Does anyone else have experience with using h2xs to create interfaces to GNU libraries? Can you give me any advice? Would I be better off using SWIG?

Kevin O'Rourke

No-one said it would be easy...

  • Comment on h2xs problems (aka: h2xs ate my memory)

Replies are listed 'Best First'.
(jcwren) Re: h2xs problems (aka: h2xs ate my memory)
by jcwren (Prior) on Nov 13, 2001 at 20:59 UTC

    I just ran this on my machine, after installing the latest versions of C::Scan and Data::Flow, and here's what I got:

    root@linux arf# time h2xs -x /usr/include/bfd.h
    Scanning typemaps...
     Scanning /usr/lib/perl5/5.00503/ExtUtils/typemap
    Scanning /usr/include/bfd.h for functions...
    Writing Bfd/Bfd.pm
    Writing Bfd/Bfd.xs
    Writing Bfd/typemap
    Writing Bfd/Makefile.PL
    Writing Bfd/test.pl
    Writing Bfd/Changes
    Writing Bfd/MANIFEST
    
    real    0m0.426s
    user    0m0.360s
    sys     0m0.060s
    root@linux arf# 
    

    No time at all. 'h2sx' is version 1.19. This all running on a mixed version RedHat system, 1Ghz Athlon, 512MB.

    --Chris

    e-mail jcwren

      Interesting...

      I tried again and got this:

      kevin@koshka1:~/dev/perl/modules > h2xs -x /usr/include/bfd.h
      Scanning typemaps...
       Scanning /usr/lib/perl5/5.6.1/ExtUtils/typemap
      Scanning /usr/include/bfd.h for functions...
      Scanning /usr/include/bfd.h for typedefs...
      Writing Bfd/Bfd.pm
      Writing Bfd/Bfd.xs
      Writing Bfd/typemap
      Killed

      There was a gap of several minutes before Killed.

      For reference: Suse Linux 7.2 w/ 2.4.13 kernel, 1.13GHz Athlon, 256MB physical, 256MB swap, binutils 011021 (development snapshot) and 2.10.91, h2xs 1.21, perl 5.6.1, C::Scan 0.74, Data::Flow 0.05.

      I also tried adding 6GB of extra swap space, h2xs swallowed the lot!

      Kevin O'Rourke