From kevin at oreilly.com Thu Dec 28 16:29:58 2000 From: kevin at oreilly.com (Kevin@O'Reilly) Date: Thu Aug 5 00:21:10 2004 Subject: Reminder: No meeting Tonight, next meeting Jan 25th Message-ID: <00d301c0711d$b64158a0$070214ac@west.ora.com> Reminder, there will be no Sonoma Perl Monger's meeting tonight. The next one will be Thursday, January 25th. Happy New Millennium! -Kevin kevin@oreilly.com From paulp at sonic.net Thu Dec 28 19:30:15 2000 From: paulp at sonic.net (paul palmer) Date: Thu Aug 5 00:21:10 2004 Subject: running out of memory in the Perl interpreter Message-ID: <00be01c07136$ea954e40$2f89ccd1@sonic> Folks: Can anyone offer me an explanation of what is probably just a small point? I had this coding: if (!&parse_template($CONFIG{"success_html_template"}, *STDOUT)) { &error("Can't open $CONFIG{"success_html_template"} ($!)."); } (the double quotes were left over from an earlier debugging session). when I ran it, the interpreter gave me an Out of memory! error message. I wasted lots of time dealing with what seemed like a really serious error. When I changed the quotes in the subroutine call to single ones, it ran normally, so: if (!&parse_template($CONFIG{'success_html_template'}, *STDOUT)) { &error("Can't open $CONFIG{'success_html_template'} ($!)."); } I don't see why that is so important. What's so terrible about nesting double quotes? Especially, why Out of memory! ? Thank you, Paul Palmer new member of Perl SIG From eric at eisenhart.com Thu Dec 28 19:40:22 2000 From: eric at eisenhart.com (Eric Eisenhart) Date: Thu Aug 5 00:21:10 2004 Subject: running out of memory in the Perl interpreter In-Reply-To: <00be01c07136$ea954e40$2f89ccd1@sonic>; from paulp@sonic.net on Thu, Dec 28, 2000 at 05:30:15PM -0800 References: <00be01c07136$ea954e40$2f89ccd1@sonic> Message-ID: <20001228174022.C21572@atlantic.devin.com> On Thu, Dec 28, 2000 at 05:30:15PM -0800, paul palmer wrote: > Folks: > > Can anyone offer me an explanation of what is probably just a small > point? > I had this coding: > > if (!&parse_template($CONFIG{"success_html_template"}, *STDOUT)) { > &error("Can't open $CONFIG{"success_html_template"} ($!)."); > } > > (the double quotes were left over from an earlier debugging session). > when I ran it, the interpreter gave me an Out of memory! error message. I > wasted lots of time dealing with what seemed like a really serious error. > When I changed the quotes in the subroutine call to single ones, it ran > normally, so: > > if (!&parse_template($CONFIG{'success_html_template'}, *STDOUT)) { > &error("Can't open $CONFIG{'success_html_template'} ($!)."); > } > > > I don't see why that is so important. What's so terrible about nesting > double quotes? Especially, why Out of memory! ? Well, that shouldn't make any meaningful difference. (though, I'd expect Perl to be very slightly slower and use very slightly more memory with double quotes) It's probably a bug. What does "perl -V" say? (please include the entire output of perl -V) I'd mostly be curious what parse_template is doing. -- Eric Eisenhart Freedom is slavery. http://eric.eisenhart.com/ ^ ICQ#: 48217244 Ignorance is strength. eric-dot-sig@eisenhart.com /e\ Perl&SQL Coder War is peace. IRC Nicks: Falsch Freiheit --- -- George Orwell From paulp at sonic.net Thu Dec 28 20:25:06 2000 From: paulp at sonic.net (paul palmer) Date: Thu Aug 5 00:21:10 2004 Subject: Out of memory condition Message-ID: <010901c0713e$a4ea3f60$2f89ccd1@sonic> To: Eric Eisenhart: Eric: Thanks for the validation. I thought I was overlooking something obvious. Since you asked, I ran the okay script with a -V switch and got this: ================================================== Summary of my perl5 (revision 5 version 6 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=undef use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion= cppflags='-DWIN32' ccflags ='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_ IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags '-nologo -nodefaultlib -release -libpath:"E:\Perl\lib\CORE" -machine:x86' libpth="E:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', ddlflags='-dll -nologo -nodefaultlib -release -libpath:"E:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 615 Built under MSWin32 Compiled at Jul 4 2000 12:54:35 @INC: E:/Program Files/Perl/Perl_programs/lib E:/Program Files/Perl/Perl_programs/site/lib ================================================== I don't really know what -V does or what to think of the output. Then I changed the quotes back to double ones and did the same thing. ==================================================== Summary of my perl5 (revision 5 version 6 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=undef use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion= cppflags='-DWIN32' ccflags ='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_ IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags '-nologo -nodefaultlib -release -libpath:"E:\Perl\lib\CORE" -machine:x86' libpth="E:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', ddlflags='-dll -nologo -nodefaultlib -release -libpath:"E:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 615 Built under MSWin32 Compiled at Jul 4 2000 12:54:35 @INC: E:/Program Files/Perl/Perl_programs/lib E:/Program Files/Perl/Perl_programs/site/lib ================================================ Then I changed the -V back to -w and reran it. I got: ============================================== Out of memory! I don't see the point of supplying the coding to parse_template because the interpreter never got as far as execution. Do you see any way for the actual construction of parse_template to affect the compilation phase as it did? Nevertheless, here it is. =================================================== sub parse_form { local($name, $value, $pair, $buffer, @pairs); # Check for request method and handle appropriately # THIS IS ALWAYS GET, NEVER POST, NO MATTER WHAT I PUT INTO
//g; # replace any html comments with blanks, even if the # comment extends over several lines. Is this to remove # any scripts, like Javascript, included in comments? # Store name/value pair in %CONFIG if the corresponding entry is # defined. $CONFIG_INIT{$name} is just used to remember if an entry # was already placed into $CONFIG{$name}. if ($CONFIG{$name} && $CONFIG_INIT{$name}) { $CONFIG{$name} .= ",$value"; } elsif (defined($CONFIG{$name})) { $CONFIG{$name} = $CONFIG_INIT{$name} = $value; } # Otherwise store in %FORM elsif ($FORM{$name}) { $FORM{$name} .= ",$value"; } else { $FORM{$name} = $value; } } return(1); } 1; =============================================== Thanks, Paul Palmer