Skip to content

High memory consumption #78

@Veslo5

Description

@Veslo5

I did some testing and found that my code take huge amount of memory. I've used lua-star module by wesleywerner for astar pathfinding which uses a lot of tables. I've tested it on both windows x64 and also on mac arm64 just to be sure.

Because of already reported bug #77 I had to change clamp function in lua-astar to this:

-- (Internal) Clamp a value to a range.
local function clamp(x, min, max)
    -- return x < min and min or (x > max and max or x)
    if x < min then return min elseif x > max then return max else return x end
end

Then I used DoFileAsync in Lua-CSharp like this:

state.OpenStandardLibraries();
var result = await state.DoFileAsync("test.lua");

test.lua

local pathFinding = require("astar.lua")

function positionIsOpenFunc(x, y)
   return true 
end

local path = pathFinding:find(10, 10, {x = 1, y = 1}, {x = 8, y = 8}, positionIsOpenFunc, false, false)

if path then
    return path
else
    return nil
end
image

Maybe Lua-CSharp is not intended to be used like this, but somebody could use this scenario for optimization or some benchmarks.

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