in reply to Re: PL_malloc_mutex in XS
in thread PL_malloc_mutex in XS

Are these flags set in standard perl build for ubuntu?

And, generally, how can I check, if perl caught a signal on memory allocating?

Replies are listed 'Best First'.
Re^3: PL_malloc_mutex in XS
by dave_the_m (Monsignor) on Jul 15, 2014 at 14:28 UTC
    And, generally, how can I check, if perl caught a signal on memory allocating?
    Generally, I think you're onto a loser here. Trying to make unsafe signals work is not easy, which is is why perl itself abandoned them about 10 years ago.

    Normal perl builds use the OS's malloc() library, since its is likely to be superior to perl's own implementaion. You could of course build a perl with perl's malloc by using the -Dusemymalloc on the Configure commnand line, then you'd have a perl with a lockable malloc and rubbish performance.

    Even then, you would still be able to do almost nothing in your signal handler, because just about anything you tried to do (apart now from malloc) would be unsafe.

    Dave.

      I can't use safe signals, because most part of my wishes are connected with MySQL. As I know, MySQL methods in perl wouldn't be terminated, when perl will catch safe signal.
Re^3: PL_malloc_mutex in XS
by syphilis (Archbishop) on Jul 15, 2014 at 13:51 UTC
    Are these flags set in standard perl build for ubuntu?

    On the system perl on my Ubuntu (12.04LTS), useithreads is defined, but usemymalloc is not:
    sisyphus@sisyphus5-desktop:~$ perl -V:usemymalloc usemymalloc='n'; sisyphus@sisyphus5-desktop:~$ perl -V:useithreads useithreads='define'; sisyphus@sisyphus5-desktop:~$
    (You'll want "usemymalloc='y'".)
    I have built some other perls, but none with -Dusemymalloc.
    Maybe you should build one ?

    Cheers,
    Rob