Skip to content

Free preProgram early in the test harness#63116

Open
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:free-preprogram
Open

Free preProgram early in the test harness#63116
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:free-preprogram

Conversation

@Andarist
Copy link
Contributor

@Andarist Andarist commented Feb 8, 2026

I'm investigating some OOMs and this helps with some test-only OOMs when the preProgram retains over half of the available space. When the final program gets executed it repeats the work done by the preProgram and tries to allocate roughly the same amount of memory. But this time the test harness OOMs given both combined exceed the node.js allowed heap space.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 8, 2026
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Feb 8, 2026
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@jakebailey
Copy link
Member

Hm, I'm not seeing a benefit; this is psrecord --include-children --plot pr.png 'npm test -- --no-lint' before/after.

image

@Andarist
Copy link
Contributor Author

Andarist commented Feb 8, 2026

You are profiling the whole test suite. This only makes the preProgram collectable early within a single test case - before the containing function exits. I was running into an OOM without this because the second program created by this function exceeded the available heap space (when the heap was still occupied by the preProgram as it was retained by the closure~).

@Andarist
Copy link
Contributor Author

Andarist commented Feb 8, 2026

You can verify the above by:

  • checking out d1633a1c44dd2423623bd52cad8224213ed5ebed
  • running npx hereby runtests --tests="crossProductUnionIntersectionRepeatedPropDeclarationsNoOOM2" --no-lint --timeout 24000000 (it should complete way before the specified timeout but the chances it won't complete under default 40s are high)
  • dropping 76748c2e028635047877960b392c6ab65b6b5125 (that's the cherry-picked commit from this PR)
  • re-running the above test command. This time it should OOM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

3 participants