Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

OperatorImportFromESRIShape causes java.lang.OutOfMemoryError

Open
#146 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
data

Research direction

Reproduce the failure with the attached data.zip and the readShape method in ShapeUtilTest1.java:68. Trace OperatorImportFromESRIShapeCursor.importFromESRIShapeMultiPath and AttributeStreamOfInt32, then determine what causes the heap exhaustion during cursor iteration. Done means the attached shape file can be imported without OutOfMemoryError, with the resulting geometries verified.

Written by the indexing model from the issue text.

Description

question

Hi together,

currently I play arround with your geometry-api-java (version 1.2.1 from maven) to read an entire shape file and stumbled over the following issue:

java.lang.OutOfMemoryError: Java heap space
	at com.esri.core.geometry.AttributeStreamOfInt32.<init>(AttributeStreamOfInt32.java:61)
	at com.esri.core.geometry.AttributeStreamBase.createIndexStream(AttributeStreamBase.java:465)
	at com.esri.core.geometry.OperatorImportFromESRIShapeCursor.importFromESRIShapeMultiPath(OperatorImportFromESRIShapeCursor.java:268)
	at com.esri.core.geometry.OperatorImportFromESRIShapeCursor.importFromESRIShape(OperatorImportFromESRIShapeCursor.java:190)
	at com.esri.core.geometry.OperatorImportFromESRIShapeCursor.next(OperatorImportFromESRIShapeCursor.java:55)
	at com.esri.core.geometry.ShapeUtilTest1.readShape(ShapeUtilTest1.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

The below snippet shows how I try to read the shape file.

public List<Geometry> readShape(InputStream shape) throws IOException
  {
    List<Geometry> geometries = new ArrayList<>();

    ByteBuffer bb = ByteBuffer.wrap(IOUtils.toByteArray(shape));
    
    GeometryCursor cursor = OperatorImportFromESRIShape.local().execute(0,
             Geometry.Type.Unknown, new SimpleByteBufferCursor(bb));

    Geometry geometry;
    while ((geometry = cursor.next()) != null)
    {
      geometries.add(geometry);
    }

    return geometries;
  }

I Hope you can help me out with my problem. I also attached the shape file.

data.zip

Dominant language
Java
Stars
710
Forks
268
Avg merge
7d 23h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Esri/geometry-api-java

All issues in Esri/geometry-api-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.