MCPcopy Create free account
hub / github.com/NixOS/nix / allocBytes

Method allocBytes

src/libexpr/include/nix/expr/eval-inline.hh:15–27  ·  view source on GitHub ↗

* Note: Various places expect the allocated memory to be zeroed. */

Source from the content-addressed store, hash-verified

13 * Note: Various places expect the allocated memory to be zeroed.
14 */
15[[gnu::always_inline]]
16inline void * EvalMemory::allocBytes(size_t n)
17{
18 void * p;
19#if NIX_USE_BOEHMGC
20 p = GC_MALLOC(n);
21#else
22 p = calloc(n, 1);
23#endif
24 if (!p)
25 throw std::bad_alloc();
26 return p;
27}
28
29[[gnu::always_inline]]
30Value * EvalMemory::allocValue()

Callers 4

new_nix_valueFunction · 0.80
eval.ccFile · 0.80
fromBuilderMethod · 0.80
ListBuilderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected