Skip to content

Torchx - Memory allocation / release problem (Only on Windows?) #1637

@m0rt3nlund

Description

@m0rt3nlund

Hi!

As discussed in https://elixirforum.com/t/torchx-oom-on-windows/73005/6 thread there is a problem on Windows where the allocations for tensors never gets released.

My setup was on Elixir 1.18.3, OTP 27
I have tried both TorchX with libtorch 2.7.1 and 2.8.0 with same results.

Code to reproduce:

defmodule Mix.Tasks.Simple do
  @impl Mix.Task
  def run(_args) do
    10000
    |> runner()
  end

  defp runner(0), do: :ok

  defp runner(ittr) do
    Task.async(fn ->
      tensor =
        Nx.broadcast(0, {1, 3, 640, 640})
        |> Nx.backend_transfer(Nx.default_backend())
    end)
    |> Task.await()

    Process.sleep(50)

    runner(ittr - 1)
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions