From eff120d1b93b99d6ae61b20e18c31a5324a2be4f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 22 Sep 2014 14:46:42 +0200 Subject: Add a function ‘valueSize’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It returns the size of value, including all other values and environments reachable from it. It is intended for debugging memory consumption issues. --- src/libexpr/value.hh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libexpr/value.hh') diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh index 2feb2f9492ca..227f5e173084 100644 --- a/src/libexpr/value.hh +++ b/src/libexpr/value.hh @@ -159,4 +159,10 @@ static inline void mkPathNoCopy(Value & v, const char * s) void mkPath(Value & v, const char * s); +/* Compute the size in bytes of the given value, including all values + and environments reachable from it. Static expressions (Exprs) are + not included. */ +size_t valueSize(Value & v); + + } -- cgit 1.4.1