Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Think about Loose Coupling
 
PerlMonks  

Re^2: Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"

by jbisbee (Pilgrim)
on Oct 27, 2004 at 17:35 UTC ( [id://403161]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"
in thread Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"

In your "patch" you used the following code
if ( (unsigned)size > 1000000 ) Perl_croak(aTHX_ "Bugger!\n")
I noticed that the author had a CROAK macro and wondered why you opted for the Perl_croak and what the difference was.
/** Storable.xs 1.0.13 **/ #define CROAK(x) do { cxt->s_dirty = 1; croak x; } while (0)
/** Storable.xs 2.13 **/ #define CROAK(x) STMT_START { cxt->s_dirty = 1; croak x; } STMT +_END
I understand that the cxt->s_dirty is used to let Storable reuse the memory next time around, just wondering what the difference between croak and Perl_croak is.

-biz-

Replies are listed 'Best First'.
Re^3:Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"
by tachyon (Chancellor) on Oct 27, 2004 at 18:50 UTC

    I was too lazy to look at the syntax of yet another macro. Storable is just one big macro! It is probably better to do:

    if ( (unsigned)size > 1000000 ) CROAK(("Bugger!\n"));

    Note that you need double parenths as the call to croak does not have any! croak is a Perl alias for Perl_croak_nocontext so the call is near identical but you are setting the context to dirty, looking at the source this is caught and cleaned so should fix the leak.

    cheers

    tachyon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://403161]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.