Skip to content

Commit 71c3fb7

Browse files
committed
fix: isDefEq has a memory leak I guess
1 parent e10b4b9 commit 71c3fb7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Mathport.lean

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def mathport1 (config : Config) (importRename : NameMap Name) (path : Path) : IO
123123
synport1 config importRename path imports3
124124
writeModule (← getEnv) $ path.toLean4olean pcfg
125125

126+
IO.eprintln s!"ported {path.mod4}"
126127
println! "\n[mathport] END {path.mod3}\n"
127128
catch err =>
128129
throw $ IO.userError

Mathport/Binary/TranslateName.lean

+10-8
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,18 @@ where
241241

242242
isDefEqUpto (lvls₁ : List Name) (t₁ : Expr) (lvls₂ : List Name) (t₂ : Expr) : BinportM Bool := do
243243
if lvls₁.length ≠ lvls₂.length then return false
244-
let t₂ := t₂.instantiateLevelParams lvls₂ $ lvls₁.map mkLevelParam
245-
let result := withMaxHeartbeatPure (50000 * 1000) <| Kernel.isDefEq (← getEnv) {} t₁ t₂
246244
if (← read).config.skipDefEq then
247-
return match result with
248-
| .ok defeq => defeq
249-
-- Remark: we translate type errors to true instead of false because
250-
-- otherwise we get lots of false positives where definitions
251-
-- depending on a dubious translation are themselves marked dubious
252-
| .error .. => true
245+
-- disabling all defeq checks because this can still blow up even with the heartbeat limit
246+
-- return match result with
247+
-- | .ok defeq => defeq
248+
-- -- Remark: we translate type errors to true instead of false because
249+
-- -- otherwise we get lots of false positives where definitions
250+
-- -- depending on a dubious translation are themselves marked dubious
251+
-- | .error .. => true
252+
return true
253253
else
254+
let t₂ := t₂.instantiateLevelParams lvls₂ $ lvls₁.map mkLevelParam
255+
let result := withMaxHeartbeatPure (50000 * 1000) <| Kernel.isDefEq (← getEnv) {} t₁ t₂
254256
ofExceptKernelException result
255257

256258
-- Note: "'" does not work any more, since there are many "'" suffixes in mathlib

0 commit comments

Comments
 (0)