good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
perl lack global variable/memory for use.But when I look up the doc I find $^M seem to meet this requirement. Below is the introduction of $^M
By default, running out of memory is an untrappable, fatal error. However, if suitably built, Perl can use the contents of $^M as an emergency memory pool after "die()"ing. Suppose that your Perl were compiled with "-DPERL_EMERGENCY_SBRK" and used Perl's malloc. Then $^M = 'a' x (1 << 16); would allocate a 64K buffer for use in an emergency. But I can't find any excerpt code about this variable. Could someone show code about this? Thanks in advance!UPDATE: Sadly, $^M is not for usage of global memory as I expect. It's only for a seldom scenario: when perl is out of memory even can't call die signal function to clean up, then if you define $^M already, perl would free $^M first and gain memory to clean up. I didn't try it though, but if you are interested in it, you can refer Is $^M a leftover April Fool? to get more discussion about $^M. I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction In reply to How use $^M? by xiaoyafeng
|
|