mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
Don't use more than a 8th of the system memory as buffers
Change-type: patch
This commit is contained in:
parent
9f29dc8b76
commit
bc092114c1
@ -18,6 +18,7 @@ import { Drive as DrivelistDrive } from 'drivelist';
|
|||||||
import * as sdk from 'etcher-sdk';
|
import * as sdk from 'etcher-sdk';
|
||||||
import { cleanupTmpFiles } from 'etcher-sdk/build/tmp';
|
import { cleanupTmpFiles } from 'etcher-sdk/build/tmp';
|
||||||
import * as ipc from 'node-ipc';
|
import * as ipc from 'node-ipc';
|
||||||
|
import { totalmem } from 'os';
|
||||||
|
|
||||||
import { toJSON } from '../../shared/errors';
|
import { toJSON } from '../../shared/errors';
|
||||||
import { GENERAL_ERROR, SUCCESS } from '../../shared/exit-codes';
|
import { GENERAL_ERROR, SUCCESS } from '../../shared/exit-codes';
|
||||||
@ -117,7 +118,11 @@ async function writeAndValidate({
|
|||||||
onProgress,
|
onProgress,
|
||||||
verify,
|
verify,
|
||||||
trim: autoBlockmapping,
|
trim: autoBlockmapping,
|
||||||
numBuffers: Math.min(2 + (destinations.length - 1) * 32, 256),
|
numBuffers: Math.min(
|
||||||
|
2 + (destinations.length - 1) * 32,
|
||||||
|
256,
|
||||||
|
Math.floor(totalmem() / 1024 ** 2 / 8),
|
||||||
|
),
|
||||||
decompressFirst,
|
decompressFirst,
|
||||||
});
|
});
|
||||||
const result: WriteResult = {
|
const result: WriteResult = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user