Permalink
Browse files

add a rb_objc_retain_count() for debug.

Example:
RoxorVM::~RoxorVM(void)
{
    printf("[deubg] ~RoxorVM : outer_stack retains = %u\n", GC_RETAIN_COUNT(outer_stack));
---- snip ----
  • Loading branch information...
1 parent eaddd07 commit a6b0db5da2500770c0d18e5e63bd4eee6713e91b @Watson1978 Watson1978 committed May 27, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 macruby_internal.h
View
@@ -31,6 +31,7 @@ boolean_t auto_zone_set_write_barrier(void *zone, const void *dest, const void *
void auto_zone_add_root(void *zone, void *address_of_root_ptr, void *value);
void auto_zone_retain(void *zone, void *ptr);
unsigned int auto_zone_release(void *zone, void *ptr);
+unsigned int auto_zone_retain_count(void *zone, const void *ptr);
extern void *__auto_zone;
#else
extern auto_zone_t *__auto_zone;
@@ -63,6 +64,13 @@ rb_objc_retain(void *addr)
}
#define GC_RETAIN(obj) (rb_objc_retain((void *)obj))
+static inline unsigned int
+rb_objc_retain_count(const void *addr)
+{
+ return auto_zone_retain_count(__auto_zone, addr);
+}
+#define GC_RETAIN_COUNT(obj) (rb_objc_retain_count((const void *)obj))
+
static inline void *
rb_objc_release(void *addr)
{

0 comments on commit a6b0db5

Please sign in to comment.