2000-09-30
2000-09-30 17:26:49 by Martin Stjernholm <mast@lysator.liu.se>
-
728b233ac2d22a62a60b5a8735db750050f3d8ae
(44 lines)
(+25/-19)
[
Show
| Annotate
]
Branch: 7.9
Another fix along the same lines.
Rev: src/gc.c:1.138
30:
#include "block_alloc.h"
- RCSID("$Id: gc.c,v 1.137 2000/09/30 16:50:29 mast Exp $");
+ RCSID("$Id: gc.c,v 1.138 2000/09/30 17:26:49 mast Exp $");
/* Run garbage collect approximately every time
* 20 percent of all arrays, objects and programs is
249:
fprintf(stderr,"in_gc : %d\n", Pike_in_gc);
}
+ #ifdef DEBUG_MALLOC
+ #define VALID_PTR(P) ((P) && (int) (P) != 0x55555555)
+ #else
+ #define VALID_PTR(P) (P)
+ #endif
+
TYPE_T attempt_to_identify(void *something)
{
struct array *a;
262:
{
if(a==(struct array *)something) return T_ARRAY;
a=a->next;
- }while(a!=&empty_array);
+ }while(VALID_PTR(a) && a!=&empty_array);
- for(o=first_object;o;o=o->next)
+ for(o=first_object;VALID_PTR(o);o=o->next)
if(o==(struct object *)something)
return T_OBJECT;
- for(p=first_program;p;p=p->next)
+ for(p=first_program;VALID_PTR(p);p=p->next)
if(p==(struct program *)something)
return T_PROGRAM;
- for(m=first_mapping;m;m=m->next)
+ for(m=first_mapping;VALID_PTR(m);m=m->next)
if(m==(struct mapping *)something)
return T_MAPPING;
else if (m->data == (struct mapping_data *) something)
return T_MAPPING_DATA;
- for(mu=first_multiset;mu;mu=mu->next)
+ for(mu=first_multiset;VALID_PTR(mu);mu=mu->next)
if(mu==(struct multiset *)something)
return T_MULTISET;
665: Inside #if defined(DEBUG_MALLOC)
fprintf(stderr,"%*s**Attempting to describe program object was instantiated from:\n",indent,"");
#ifdef DEBUG_MALLOC
if ((int) p == 0x55555555)
- fprintf(stderr, "%*%s**Zapped program pointer\n", indent, "");
+ fprintf(stderr, "%*s**Zapped program pointer.\n", indent, "");
else
#endif
low_describe_something(p, T_PROGRAM, indent, depth, flags);
797:
fprintf(stderr,"%*s**Location: %p Type: %s Refs: %d\n",indent,"",a,
get_name_of_type(t),
*(INT32 *)a);
- }
+
#ifdef DEBUG_MALLOC
if(!(flags & DESCRIBE_NO_DMALLOC))
805:
#endif
low_describe_something(a,t,indent,depth,flags);
+ }
-
+
fprintf(stderr,"%*s*******************\n",indent,"");
d_flag=tmp;
}