3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/boehm-gc/default.nix

70 lines
2.4 KiB
Nix
Raw Normal View History

2019-06-18 10:07:56 +01:00
{ lib, stdenv, fetchurl
, autoreconfHook
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
, 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 {
pname = "boehm-gc";
version = "8.0.4";
src = fetchurl {
urls = [
"https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
"https://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
];
sha256 = "1798rp3mcfkgs38ynkbg2p47bq59pisrc6mn0l20pb5iczf0ssj3";
};
2016-12-03 22:04:21 +00:00
outputs = [ "out" "dev" "doc" ];
2019-09-29 10:18:02 +01:00
separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl";
2013-08-26 11:04:19 +01:00
preConfigure = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
export NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
'';
2019-09-29 10:18:02 +01:00
patches = # https://github.com/ivmai/bdwgc/pull/208
lib.optional stdenv.hostPlatform.isRiscV ./riscv.patch
# boehm-gc whitelists GCC threading models
++ lib.optional stdenv.hostPlatform.isMinGW ./mcfgthread.patch;
configureFlags =
[ "--enable-cplusplus" "--with-libatomic-ops=none" ]
2019-02-13 04:36:55 +00:00
++ lib.optional enableLargeConfig "--enable-large-config";
2012-10-03 19:06:53 +01:00
nativeBuildInputs =
lib.optional stdenv.hostPlatform.isMinGW autoreconfHook;
doCheck = true; # not cross;
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.
'';
homepage = "https://hboehm.info/gc/";
# non-copyleft, X11-style license
license = "https://hboehm.info/gc/license.txt";
2015-01-13 21:33:24 +00:00
maintainers = [ ];
platforms = lib.platforms.all;
};
}