books
Free Books / Computers / Practical mod_perl /

previous page: 22.3.9. Callback called exit
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: 22.3.11. syntax error at /dev/null line 1, near "line arguments:"

22.3.10. Out of memory!




Description

This section is from the "Practical mod_perl" book, by Stas Bekman and Eric Cholet. Also available from Amazon: Practical mod_perl

If something goes really wrong with your code, Perl may die with an "Out of memory!" and/or "Callback called exit" message. Common causes of this are infinite loops, deep recursion, or calling an undefined subroutine.

If -DPERL_EMERGENCY_SBRK is defined, running out of memory need not be a fatal error: a memory pool can be allocated by using the special variable $^M. See the perlvar manpage for more details.

If you compile with that option and add use Apache::Debug level => 4; to your Perl code, it will allocate the $^M emergency pool and the $SIG{_ _DIE_ _} handler will call Carp::confess( ), giving you a stack trace that should reveal where the problem is. See the Apache::Resource module for the prevention of spinning httpds.

Note that Perl 5.005 and later have PERL_EMERGENCY_SBRK turned on by default.

Another trick is to have a startup script initialize Carp::confess( ), like this:

use Carp ( );
eval { Carp::confess("init") };

This way, when the real problem happens, Carp::confess doesn't eat memory in the emergency pool ($^M).

 

Continue to:

  • prev: 22.3.9. Callback called exit
  • Table of Contents
  • next: 22.3.11. syntax error at /dev/null line 1, near "line arguments:"

Books by Stas Bekman:















TOP
previous page: 22.3.9. Callback called exit
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: 22.3.11. syntax error at /dev/null line 1, near "line arguments:"

Topics

  • Animals
  • Architecture
  • Arts
  • Business
  • Computers
  • Crafts
  • Fairy Tales
  • Finance
  • Flora and Plants
  • Cooking
  • Gardening
  • Health and Healing
  • History
  • Home Improvements
  • Languages
  • New Age
  • Novels
  • Real Estate
  • Reference
  • Religion
  • Science
  • Society
  • Sports
  • Travel
  • Outdoors


Search

My Books

Headaches Begone! A Systemic Approach To Healing Your Headaches
Don't Let Your Bike Seat Ruin Your Sex Life Book

Discover

  • Answers FAQ

[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007-2021 StasoSphere.com