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

75 lines
2.6 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 14:19:25 +00: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 20:01:43 +00:00
}:
2012-10-03 18:06:53 +00:00
stdenv.mkDerivation rec {
name = "boehm-gc-${version}";
2018-09-19 22:28:41 +00:00
version = "7.6.8";
src = fetchurl {
urls = [
"http://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
"https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
];
2018-09-19 22:28:41 +00:00
sha256 = "0n720a0i584ghcwmdsjiq6bl9ig0p9mrja29rp4cgsqvpz6wa2h4";
};
2016-12-03 22:04:21 +00:00
buildInputs = [ libatomic_ops ];
nativeBuildInputs = [ pkgconfig ];
outputs = [ "out" "dev" "doc" ];
2017-07-05 14:04:54 +00:00
separateDebugInfo = stdenv.isLinux;
2013-08-26 10:04:19 +00:00
preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
export NIX_CFLAGS_COMPILE+="-D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
'';
patches = [ (fetchpatch {
url = "https://gitweb.gentoo.org/proj/musl.git/plain/dev-libs/boehm-gc/files/boehm-gc-7.6.0-sys_select.patch";
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 18:06:53 +00:00
doCheck = true; # not cross;
2012-10-03 18:06:53 +00:00
# Don't run the native `strip' when cross-compiling.
dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
2012-10-03 18:06:53 +00: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;
};
}