nixpkgs/pkgs/development/libraries/boehm-gc/default.nix

76 lines
2.7 KiB
Nix
Raw Normal View History

nix: use boehmgc with enableLargeConfig = true Fixes #43015 for me and hopefully also similar issues. == Resource consumption == TL;DR: no change for small-memory cases, less CPU for large-memory cases. I assume almost all of the large memory usage is just the expression evaluation and managed by the GC, so I used just `nix-env -q...` to test. Old and new lines for each command follow. I tried to run each several times, but the values were very stable (<1% difference on re-runs), so only one line for each command-version pair is provided. $ time nix-env -f . -qaP --description -A nix >/dev/null - 0.06user 0.01system 0:00.07elapsed 101%CPU (0avgtext+0avgdata 29036maxresident)k + 0.06user 0.01system 0:00.07elapsed 102%CPU (0avgtext+0avgdata 29864maxresident)k $ time nix-env -f . -qaP --description >/dev/null - 6.45user 0.36system 0:06.82elapsed 99%CPU (0avgtext+0avgdata 1021024maxresident)k + 6.23user 0.33system 0:06.57elapsed 100%CPU (0avgtext+0avgdata 938408maxresident)k $ time nix-env -f . --show-trace -qa --drv-path --system --meta --xml 2>&1 >/dev/null - 56.35user 0.96system 0:31.03elapsed 184%CPU (0avgtext+0avgdata 3207708maxresident)k + 44.80user 0.91system 0:26.12elapsed 175%CPU (0avgtext+0avgdata 3192696maxresident)k $ time ./result-nix-large/bin/nix-instantiate --dry-run --eval --strict \ --show-trace ./maintainers/scripts/eval-release.nix > /dev/null - Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS - Command terminated by signal 6 - 175.18user 2.68system 1:17.42elapsed 229%CPU (0avgtext+0avgdata 8468440maxresident)k + 178.48user 2.78system 1:15.11elapsed 241%CPU (0avgtext+0avgdata 8460572maxresident)k
2018-07-04 15:19:25 +01:00
{ lib, stdenv, fetchurl, fetchpatch, pkgconfig, libatomic_ops
, enableLargeConfig ? false # doc: https://github.com/ivmai/bdwgc/blob/v7.6.6/doc/README.macros#L179
2017-06-28 21:01:43 +01:00
}:
2012-10-03 19:06:53 +01:00
stdenv.mkDerivation rec {
name = "boehm-gc-${version}";
version = "8.0.2";
src = fetchurl {
urls = [
"https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
"http://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
];
sha256 = "1jsixcpdwy5cgq5s9fi3bdlid9zh46vakymf3nbjffianyss932f";
};
2016-12-03 22:04:21 +00:00
buildInputs = [ libatomic_ops ];
nativeBuildInputs = [ pkgconfig ];
outputs = [ "out" "dev" "doc" ];
2017-07-05 15:04:54 +01:00
separateDebugInfo = stdenv.isLinux;
2013-08-26 11:04:19 +01:00
preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
export NIX_CFLAGS_COMPILE+="-D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
'';
patches = [ (fetchpatch {
name = "boehm-gc-7.6.0-sys_select.patch";
url = "https://gitweb.gentoo.org/proj/musl.git/plain/dev-libs/boehm-gc/files/boehm-gc-7.6.0-sys_select.patch?id=85b6a600996bdd71162b357e9ba93d8559342432";
sha256 = "1gydwlklvci30f5dpp5ccw2p2qpph5y41r55wx9idamjlq66fbb3";
2018-02-18 06:40:29 +00:00
}) ] ++
# https://github.com/ivmai/bdwgc/pull/208
lib.optional stdenv.hostPlatform.isRiscV ./riscv.patch;
configureFlags =
[ "--enable-cplusplus" ]
++ lib.optional enableLargeConfig "--enable-large-config"
++ lib.optional (stdenv.hostPlatform.libc == "musl") "--disable-static";
2012-10-03 19:06:53 +01:00
doCheck = true; # not cross;
2012-10-03 19:06:53 +01:00
# Don't run the native `strip' when cross-compiling.
dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
2012-10-03 19:06:53 +01:00
2017-11-21 17:58:48 +00:00
enableParallelBuilding = true;
meta = {
description = "The Boehm-Demers-Weiser conservative garbage collector for C and C++";
longDescription = ''
The Boehm-Demers-Weiser conservative garbage collector can be used as a
garbage collecting replacement for C malloc or C++ new. It allows you
to allocate memory basically as you normally would, without explicitly
deallocating memory that is no longer useful. The collector
automatically recycles memory when it determines that it can no longer
be otherwise accessed.
The collector is also used by a number of programming language
implementations that either use C as intermediate code, want to
facilitate easier interoperation with C libraries, or just prefer the
simple collector interface.
Alternatively, the garbage collector may be used as a leak detector for
C or C++ programs, though that is not its primary goal.
'';
2014-11-18 00:47:23 +00:00
homepage = http://hboehm.info/gc/;
# non-copyleft, X11-style license
2014-11-18 00:47:23 +00:00
license = http://hboehm.info/gc/license.txt;
2015-01-13 21:33:24 +00:00
maintainers = [ ];
platforms = stdenv.lib.platforms.all;
};
}