summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/tcmalloc.js
blob: 81b8aaec186762152de33083d5938cc8a4a554fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Assert setting tcmalloc_release_rate with setParameter.

(function() {
"use strict";

// Check that setParameter is available on this build. And whether tcmallocReleaseRate is.
function hasTcSetParameter() {
    const commandResult = db.adminCommand({getParameter: 1, tcmallocReleaseRate: 1});
    if (commandResult.ok)
        return true;
    else
        return false;
}

if (hasTcSetParameter()) {
    assert.commandWorked(db.adminCommand({setParameter: 1, tcmallocReleaseRate: 10}));
    assert.commandWorked(db.adminCommand({setParameter: 1, tcmallocReleaseRate: 5.0}));
    assert.commandWorked(db.adminCommand({setParameter: 1, tcmallocReleaseRate: 0.01}));
    assert.commandWorked(db.adminCommand({setParameter: 1, tcmallocReleaseRate: 0}));
    assert.commandFailed(db.adminCommand({setParameter: 1, tcmallocReleaseRate: -1.0}));
    assert.commandFailed(db.adminCommand({setParameter: 1, tcmallocReleaseRate: "foo"}));
}
}());