SWIGMapscript: glibc detected malloc memory corruption

Geo-IT GmbH info at GEO-IT.COM
Sun Jun 26 00:08:59 PDT 2005


Dear experts,
When trying to fetch a shapeObj after a queryByPoint using the shapeindex and
tileindex from the resultCache in a Java mapscript program I get the following
error terminating the whole VM:

*** glibc detected *** malloc(): memory corruption: 0x08314ed0 ***
./runshapetest40.sh: line 13: 26946 Aborted java ShapeObjTest40 $mapfile
$layername

The program was:

// Standard imports
import java.io.*;
import java.util.*;
import java.text.*;
import edu.umn.gis.mapscript.*;

public class ShapeObjTest {

	String mapFile = null;
	String layerName = null;


static {
        try {
                System.loadLibrary("mapscript");
                System.out.println("Mapscript lib loaded");
        } catch (UnsatisfiedLinkError e) {
                e.printStackTrace();
                System.exit(1);
        }
}

	public ShapeObjTest() {
	}


	protected static void log(String msg) {
		System.out.println(msg);
	}
	protected static void usage() {
		System.out.println("USAGE: ShapeObjTest <mapfile> <layername>");
	}

        public static void main (String args[] ) {
                if (args == null || args.length < 2) {
			usage();
			System.exit(1);
		}
		String mapFile = args[0];
		String layerName = args[1];
	try {
		log("Creating map");
		mapObj map = new mapObj(mapFile);
		layerObj l = map.getLayerByName(layerName);
		l.open();
		log("Fetching shapeObj shapeindex 1 tileindex -1");
		shape = l.getFeature(1,-1);
		l.close();
		log("Fetch successful");
	} catch (Exception ie) {
		ie.printStackTrace();
		System.exit(1);
	}
        }
}

The log shows:
Mapscript lib loaded
Creating map
Fetching shapeObj shapeindex 1 tileindex -1

Then the error appears on the console.

I use mapserver 4.6.0.

This is the mapfile: (It's the one from Itasca demo, but only with layer
airports)
MAP
  #
  # Start of map file
  #
  NAME "DEMO"
  STATUS ON
  EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897
  SIZE 600 600
  SHAPEPATH "data"
  IMAGECOLOR 255 255 255
  UNITS METERS
  # you may need to change this to match your MapServer build
  #IMAGETYPE PNG
  #
  # Projection definition, consult the PROJ.4 documentation for parameter
discussion
  #
  PROJECTION
    "proj=utm"
    "ellps=GRS80"
    "zone=15"
    "north"
    "no_defs"

#  OR:
  #
  #  "init=epsg:26915"
  END
  #
  # Start of web interface definition (including WMS enabling metadata)
  #
  WEB
    MINSCALE 1000
    MAXSCALE 1550000
    IMAGEPATH "/tmp"
    IMAGEURL "/tmp"
    HEADER "demo_header.html"
    FOOTER "demo_footer.html"
    TEMPLATE "demo.html"
    METADATA
      "WMS_TITLE"    "UMN MapServer Itasca Demo"
      "WMS_ABSTRACT"    "This is the UMN MapServer demonstration application
for Itasca County located in north central Minnesota."
      "WMS_ACCESSCONSTRAINTS"    "none"
      "WMS_ONLINERESOURCE"   
"http://localhost.localdomain/mapserver_demos/itasca/demo_init.html"
      "WMS_SRS"    "EPSG:26915"
    END
  END
  #
  # Start of reference map
  #
  REFERENCE
    STATUS ON
    IMAGE "graphics/reference.gif"
    SIZE 120 120
    EXTENT 393234.393701263 5205405.16440722 495769.579718949 5307959.02579127
    COLOR -1 -1 -1
    OUTLINECOLOR 255 0 0
  END
  QUERYMAP
    STATUS ON
    SIZE 200 200
    COLOR 255 0 0
    STYLE HILITE
  END
  #
  # Start of legend
  #
  LEGEND
    STATUS ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END
  #
  # Start of scalebar
  #
  SCALEBAR
    STATUS ON
    COLOR 0 102 102
    OUTLINECOLOR 102 255 0
    BACKGROUNDCOLOR 255 51 102
    IMAGECOLOR 255 255 255
    TRANSPARENT OFF
    UNITS MILES
    INTERVALS 1
    SIZE 80 2
    STYLE 1
    INTERLACE ON
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 0
    END
  END
  #
  # Start of symbol definitions (we're only using a few)
  #
  SYMBOL
    NAME "circle"
    TYPE ELLIPSE
    FILLED TRUE
    POINTS
       1 1
    END
  END
  #
  # Start of layer definitions
  #
  LAYER
    NAME "airports"
    STATUS OFF
    DATA "airports"
    TYPE POINT
    TOLERANCE 5
    HEADER "airports_header.html"
    FOOTER "airports_footer.html"
    TEMPLATE "ttt.html"
    METADATA
      "WMS_TITLE"    "Airports"
      "WMS_ABSTRACT"    "Airport runways for Itasca County."
      "WMS_SRS"    "EPSG:26915"
    END
    CLASS
      NAME "Airports"
      SYMBOL "circle"
      COLOR 128 255 164
      SIZE 7
      TEMPLATE "airports.html"
    END
  END



Any help would be greatly appreciated.

Mit freundlichen Gruessen/Kind regards
Andreas Paukner-Ruzicka
(Geschaeftsfuehrer/Managing director)

**********************************************************
Geo-IT GmbH   -   Geoinformatik, IT-Services
Guggenberg 3, D-82380 Peissenberg
Tel: 08803-498372, Fax: 08803-498373
eMail: info at geo-it.com  -  Homepage: http://www.geo-it.com
**********************************************************



More information about the MapServer-users mailing list