foo.h ------------------------------------------------------
class Foo {
public:
void bar();
};
####
foo.cpp ----------------------------------------------------
#include
#include "foo.h"
void Foo::bar() {
throw std::runtime_error("oh no!");
}
####
Foo.xs -----------------------------------------------------
void
Foo::bar()
CODE:
try {
THIS->bar();
}
catch (const std::runtime_error &e) {
croak("Foo::bar threw a runtime error!");
}
####
30,969 bytes in 999 blocks are possibly lost in loss record 1,064 of 1,069
at 0x4A0666E: operator new(unsigned long) (vg_replace_malloc.c:220)
by 0x929F070: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator const&) (new_allocator.h:89)
by 0x929FCA4: char* std::string::_S_construct(char const*, char const*, std::allocator const&, std::forward_iterator_tag) (basic_string.tcc:139)
by 0x929FE41: std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&) (basic_string.h:1546)
by 0x8FFEABF: Foo::bar() (foo.cpp:6)
by 0x8DFC856: XS_Foo_bar (in /home/slower/dev/xstest/src/blib/arch/auto/Foo/Foo.so)
by 0x49291F: Perl_pp_entersub (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
by 0x490D35: Perl_runops_standard (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
by 0x43410B: perl_run (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
by 0x41E51B: main (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
143,856 bytes in 999 blocks are possibly lost in loss record 1,068 of 1,069
at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
by 0x92BF206: __cxa_allocate_exception (eh_alloc.cc:102)
by 0x8FFEACD: Foo::bar() (foo.cpp:6)
by 0x8DFC856: XS_Foo_bar (in /home/slower/dev/xstest/src/blib/arch/auto/Foo/Foo.so)
by 0x49291F: Perl_pp_entersub (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
by 0x490D35: Perl_runops_standard (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
by 0x43410B: perl_run (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)
by 0x41E51B: main (in /usr/local/perl/5.12.2-gcc443-rhel5-64/bin/perl)