Skip to content

Ice fill solver (very rarely) causing extreme lag #147

@TheDGOfficial

Description

@TheDGOfficial

Basically this been happened a lot of times to me in the past and whenever it happens my memory allocation rate goes above upwards of 1 GB/s trash being generated and garbage collected by the JVM, which makes the game have extreme lag and makes it unplayable. I always restarted to fix it and kinda lived with it, although everytime I tried to find the cause as well before restarting; i always failed to find the cause.

I couldn't find the cause before because I only looked at heap dumps since i suspected a memory leak or something. But today I took thread dump and I saw the findSolution method is perhaps stuck in an infinite recursion. Why it doesn't give StackOverflowError and abort is beyond my understanding. Also I'm out of dungeons and it still keeps appearing on thread dumps a.k.a it still tries to find a solution.

Please use a loop instead of recursion and minimize/remove Point and ArrayList allocations altogether, and perhaps add a isInDungeons or even isInIceFillRoom check to not continue trying to find a solution if not in ice fill room or in dungeons.

Thanks

Screenshot from 2023-08-24 18-41-16
Screenshot from 2023-08-24 18-43-26

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