Skip to content

OutOfMemoryError in CPathfindingProcessor with pathing grid 1440x1440 #102

@tdauth

Description

@tdauth

I have modified the code with some logging:

	public CPathfindingProcessor(final PathingGrid pathingGrid, final CWorldCollision worldCollision) {
		this.pathingGrid = pathingGrid;
		this.worldCollision = worldCollision;
		this.nodes = new Node[pathingGrid.getHeight()][pathingGrid.getWidth()];
		this.cornerNodes = new Node[pathingGrid.getHeight() + 1][pathingGrid.getWidth() + 1];
		System.err.println("Nodes length " + this.nodes.length);
		for (int i = 0; i < this.nodes.length; i++) {
			System.err.println("Inner Nodes length " +  this.nodes[i].length);
			for (int j = 0; j < this.nodes[i].length; j++) {
				this.nodes[i][j] = new Node(new Point2D.Float(pathingGrid.getWorldX(j), pathingGrid.getWorldY(i))); // <--- OutOfMemoryError
			}
		}
		for (int i = 0; i < this.cornerNodes.length; i++) {
			for (int j = 0; j < this.cornerNodes[i].length; j++) {
				this.cornerNodes[i][j] = new Node(
						new Point2D.Float(pathingGrid.getWorldXFromCorner(j), pathingGrid.getWorldYFromCorner(i))); // <--- OutOfMemoryError
			}
		}
		this.pathingGridCellCount = pathingGrid.getWidth() * pathingGrid.getHeight();
	}

I started my map WoW Reforged 4.6 and got the OutOfMemoryError. Both lengths are 1440.
Both the nodes and the cornerNodes would lead to an OutOfMemoryError. Manually changing the size to 5x5 would fix this issue. I have 16 GiBytes RAM but not sure how much Java can use. I start it via command line:

./gradlew :desktop:runGame -Pargs="-loadfile $MAP_DIR -ini $INI_FILE -window"

Increasing the memory does not help:

JAVA_TOOL_OPTIONS="-Xmx4g -Xms1g" ./gradlew :desktop:runGame -Pargs="-loadfile $MAP_DIR -ini $INI_FILE -window"

This is my map https://www.hiveworkshop.com/threads/world-of-warcraft-reforged-4-6.355942/
Dimensions 354x354 (360x360)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions