[mapserver-users] mapscript: reusing mapObj (for FastCGI)

Tom Poindexter tpoindex at nyx.net
Mon Oct 22 12:38:43 EDT 2001


Try instantiating the mapObj as:
	set map [ms::mapObj -args alex_big.map]

then use Tcl rename to destroy the map:
	rename $map {}

I do this technique in msexplorer.tcl (MapServer Workbench tool), and it
can generally load more than one mapfile in it's lifetime.  SWIG is a little 
vague in which instantiation to use to get a truly anonymous object 
and reference.

Another possibility is to have one FastCGI server for each mapfile you
want to serve, and open the mapfile just once upon initialization of the
FastCGI server.   You probably still want to monitor memory usage, and
possibily exit the FastCGI server after some number of hits, to let
it re-initialize.


Re: "mapscript::" vs. "ms::"  - I considered using a shorter namespace (like
"ms"), but instead decided to go with a more descriptive name.  I'll see if I 
can add a configure option to allow a namespace option at build time.

Keep up informed on how your FastCGI server turns out.  I think several others
on the list are also interested in a FastCGI adaptation for MapServer.

-Tom



On Mon, Oct 22, 2001 at 02:24:34PM +0300, Andrey Pilipetz wrote:
> Hello.
> 
> I tried to use tcl Mapscript 3.5 to create FastCGI Server.
> I think it is not problem with tcl but with Mapcript at all.
> I have some problems when opening map file twice.
> When studeing the problem, I'v the next result:
> 
> > uname -a
> SunOS ultra 5.8 Generic_108528-05 sun4u sparc SUNW,Ultra-60
> > tclsh
> % load /usr/local/lib/libmstcl.so
> invalid command name "ms_error_get"
> % set map [ms::new_mapObj "alex_big.map"]
> _66720_mapObj_p
> % ms::msSaveImage [ms::mapObj_draw $map] "1.png" 1 0 1 75
> 0
> % set map1 [ms::new_mapObj "alex_small.map"]
> NULL
> % ms::delete_mapObj $map
> % set map1 [ms::new_mapObj "alex_small.map"]
> NULL
> %
> 
> Does anybody know something about What is going on?
> Or may be I do something wrong? 
> 
> 
> (To Tom Poindexter:
>  I have patched mapscript to use "ms" instead of long "mapscript"
>  namespace, and libmstcl.so (like libpgtcl.so) as a library name. I use
>  native tcl interface without object wrapper.
>  It would be nice have this changes in next version of tcl
>  mapscript.)
> 
> 
> -- 
> regards
> Andrey S. Pilipetz

-- 
Tom Poindexter
tpoindex at nyx.net
http://www.nyx.net/~tpoindex/



More information about the mapserver-users mailing list