pike.git
/
src
/
modules
/
_Debug
/
debug.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/_Debug/debug.cmod:1:
-
/*
+
/*
-*- c -*-
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. */ #include "global.h" #include "module.h" #include "pike_error.h" #include "interpret.h" #include "pike_embed.h"
pike.git/src/modules/_Debug/debug.cmod:46:
ref_push_object( o ); safe_apply_svalue( Pike_sp-2, 1, 1 ); pop_stack(); } total++; o = next; } RETURN total; }
+
/*! @decl int refs(string|array|mapping|multiset|function|object|program o)
+
*! @belongs Debug
+
*!
+
*! Return the number of references @[o] has.
+
*!
+
*! It is mainly meant for debugging the Pike runtime, but can also be
+
*! used to control memory usage.
+
*!
+
*! @note
+
*! Note that the number of references will always be at least one since
+
*! the value is located on the stack when this function is executed.
+
*!
+
*! @seealso
+
*! @[_next()], @[_prev()]
+
*/
+
PIKEFUN int refs(string|array|mapping|multiset|function|object|program o)
+
{
+
RETURN o->u.refs[0];
+
}
+
+
#ifdef PIKE_DEBUG /* This function is for debugging *ONLY* * do not document please. /Hubbe */ PIKEFUN int leak(array|mapping|multiset|object|function|program|string|type val) export; { INT32 i; if(!REFCOUNTED_TYPE(TYPEOF(*val)))