#!/usr/bin/python3.6 """Simple Python test program for malloc-wrapper.so.""" import sys import signal import faulthandler def sighandler(signum, stackframe): """Output signal caught to stderr.""" # signal.signal(signum, sighandler) print("Caught signal {}".format(signal.Signals(signum).name), file=sys.stderr, flush=True) faulthandler.dump_traceback(file=sys.stderr, all_threads=True) print("Done dumping stacks", file=sys.stderr, flush=True) def main(): """Do some memory allocation and releasing.""" signal.signal(signal.SIGUSR1, sighandler) pointer1 = 'a' * 100 pointer2 = 'b' * 101 print(pointer1) print(pointer2) del pointer2 del pointer1 sys.exit(0) main()