Skip to content

runtests: verify maximum memory-use per test#17821

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/memory-limits
Closed

runtests: verify maximum memory-use per test#17821
bagder wants to merge 1 commit intomasterfrom
bagder/memory-limits

Conversation

@bagder
Copy link
Member

@bagder bagder commented Jul 4, 2025

The idea here is to set limits per test how many allocations and maximum amount of memory it is allowed to use. This is a means to make sure the number and total size of allocations are kept in check and don't mistakenly "blow up".

If runtests.pl detects that the given limits have been exceeded it fails the test case with an error.

The <verify> part now supports <limits>, and in this section two limits can be set for each test (verified in debug builds only):

Allocations: [number of allocation calls]
Maximum allocated: [maximum concurrent memory allocated]

Default limits (used if nothing is set in the test file):

Allocations: 1000
Maximum allocated: 1000000

@bagder bagder added the tests label Jul 4, 2025
@bagder bagder changed the title runtests: support memory-limits per test runtests: verify maximum memory-use per test Jul 5, 2025
@bagder bagder marked this pull request as ready for review July 5, 2025 14:46
@bagder
Copy link
Member Author

bagder commented Jul 5, 2025

An alternative to checking the sizes post-test is to trigger an error from the memory call at the limit instead, which then should cause a run-time error getting returned. The downside with such an approach that is then we don't get to know how many allocations or how much memory the test would eventually use, which we get now when we check the used data after the fact.

The idea here is to set limits per test how many allocations and maximum
amount of memory it is allowed to use. This is a means to make sure the
number and total size of allocations are kept in check and don't
mistakenly "blow up".

If runtests.pl detects that the given limits have been exceeded it fails
the test case with an error.

The `<verify>` part now supports `<limits>`, and in this section two
limits can be set for each test (verified in debug builds only):

    Allocations: [number of allocation calls]
    Maximum allocated: [maximum concurrent memory allocated]

Default limits (used if nothing is set in the test file):

    Allocations: 1000
    Maximum allocated: 1000000

Closes #17821
@bagder bagder force-pushed the bagder/memory-limits branch from 547b38f to f00a2ad Compare July 6, 2025 18:33
@bagder bagder closed this in 8724306 Jul 8, 2025
@bagder bagder deleted the bagder/memory-limits branch July 8, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant