Skip to content

Allocation getting CanonicalConstraintFunction #1353

@blegat

Description

@blegat
using MathOptInterface; const MOI = MathOptInterface
function f()
    model = MOI.Utilities.Model{Float64}()
    x = MOI.add_variable(model)
    c = MOI.add_constraint(model, 1.0 * MOI.SingleVariable(x), MOI.EqualTo(1.0))
    @time MOI.get(model, MOI.CanonicalConstraintFunction(), c)
end
f()

gives

  0.000001 seconds (1 allocation: 16 bytes)

I don't understand where this allocation comes from. It was allocation-free after #1318. This must be due to a recent change.

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