<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:st1 = 
"urn:schemas-microsoft-com:office:smarttags"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-2022-jp">
<META content=Word.Document name=ProgId>
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<META content="Microsoft Word 10" name=Originator><LINK 
href="cid:filelist.xml@01C0D8A3.5D780730" rel=File-List><o:SmartTagType 
name="PostalCode" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
name="Street" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
name="State" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
name="City" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
name="place" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
name="address" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]>
<STYLE>st1\:* {
        BEHAVIOR: url(#default#ieooui)
}
</STYLE>
<![endif]-->
<STYLE>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:553679495 -2147483648 8 0 66047 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
        {margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</STYLE>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=EN-US style="tab-interval: .5in" vLink=purple link=blue 
bgColor=#ffffff>
<DIV><FONT size=2>hi,</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>i'm using mapserver 3.3.011 on redhat 6.2.&nbsp; i'm 
generating my map image using mapscript perl module on mod_perl 1.25 on apache 
1.3.9.&nbsp; </FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>i'm not doing anything complicated, just grabbing a map file 
and generating the image, my problem is that when i'm monitoring my memory usage 
increases pretty darn fast when printing heavy maps.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>i've included code that i'm using at the bottom, if anyone 
sees anything obviously stupid i'd be happy to hear what it is.&nbsp; i'm a cold 
fusion programmer a little new to mod perl.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>my goal right now is to share as much memory as possible, i've 
already done a perlrequire to a script that loads mapscript and all my other 
modules into the parent process, </FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>i'm guessing my $map and $img vars are my biggest concern, is 
there anyway that i can code this so that i am sharing these variables across 
all httpd processes(assuming i'm not already) like my modules?</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>also rather than create new map objects on each request&nbsp;i 
tried</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; if (!defined $map) {$map = new 
mapObj(file);}</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>but when i printed the map it had garbled data from the 
prviously drawn map, is there a way to flush/clean out the image so this 
works?</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>any help would be greatly appreciated,</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>matt</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>------ here's a stripped version of my code, i call it from 
within an&nbsp;html img tag.&nbsp;--------------</FONT></DIV>
<DIV><FONT size=2>#!/usr/bin/perl</FONT></DIV>
<DIV><FONT size=2>use mapscript;<BR>use XBase;</FONT></DIV>
<DIV><FONT size=2>require "glbLib/parse_form.pl";<BR>require 
"glbLib/util.pl";</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>my %formdata;<BR>%formdata = parse_form();<BR>my @ti = 
localtime(time);</FONT></DIV>
<DIV><FONT size=2>###### parse query string for vars ##########</FONT></DIV>
<DIV><FONT size=2>my $key;<BR>my ($lat,$lon,$zoom);<BR>my $zm;<BR>my 
$filename;<BR>my $flvar = do_count("./","mapctr",1000);<BR>my $mapfile;<BR>my 
$numpoints = 0;<BR></FONT><FONT size=2>##### create a filename using time and 
file numbers ####</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>$filename = "MS_"<A 
href='mailto:.@ti[5]."-".@ti[4]."-".@ti[3]."--".@ti[2]."-".@ti[1]."-".@ti[0]."*".$flvar'>.@ti[5]."-".@ti[4]."-".@ti[3]."--".@ti[2]."-".@ti[1]."-".@ti[0]."*".$flvar</A>;<BR>$mapfile 
= "/usr/local/apache/htdocs/tmp/".$filename;<BR>&nbsp; foreach $key (sort 
keys(%formdata)){<BR>&nbsp;&nbsp;&nbsp; if ($key 
=~m/mlat/){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $lat = 
$formdata{$key};<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; elsif ($key 
=~m/mlon/){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $lon = 
$formdata{$key};<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; elsif ($key 
=~m/zoom/){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $zoom = 
$formdata{$key};<BR>&nbsp;&nbsp;&nbsp; }&nbsp; </FONT></DIV>
<DIV><FONT size=2>&nbsp;}</FONT></DIV>
<DIV><FONT size=2><BR>$map = new 
mapObj('/usr/local/apache/perl/demo.map');</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>my ($CVlat,$CVlon) = latToMeter($lat);</FONT></DIV>
<DIV><FONT size=2>my $latdf = $zoom * 500 * $CVlat;<BR>my $londf = $zoom * 500 * 
$CVlon;</FONT></DIV>
<DIV><FONT size=2>$map-&gt;{extent}-&gt;{maxx} = $lon + 
$londf;<BR>$map-&gt;{extent}-&gt;{minx} = $lon - 
$londf;<BR>$map-&gt;{extent}-&gt;{maxy} = $lat + 
$latdf;<BR>$map-&gt;{extent}-&gt;{miny} = $lat - $latdf;<BR>$img = 
$map-&gt;draw() or die('unable to draw map');<BR></FONT><FONT 
size=2><BR>####################### draw map and save 
#################</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT 
size=2>$map-&gt;drawLabelCache($img);<BR>mapscript::msSaveImage($img,$mapfile,0,0);<BR>mapscript::msFreeImage($img);</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>##### read in file and stream it into page, set content type. 
####</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>print "Content-type: 
image/gif\r\n\r\n";<BR>open(FILE,$mapfile);<BR>binmode(FILE);<BR>@buffer = 
&lt;FILE&gt;;</FONT></DIV>
<DIV><FONT size=2>foreach (@buffer){<BR>&nbsp; print $_;<BR>}</FONT></DIV>
<DIV><FONT size=2>close(FILE);</FONT></DIV>
<DIV><FONT size=2>system("rm -f $mapfile");<BR>undef $map;</FONT></DIV>
<DIV><FONT size=2>############################ end 
############################</FONT></DIV></BODY></HTML>