… | |
… | |
201 | { |
201 | { |
202 | if (i >= mortals.size ()) |
202 | if (i >= mortals.size ()) |
203 | { |
203 | { |
204 | i = 0; |
204 | i = 0; |
205 | |
205 | |
206 | if (mortals.size () > 1000) |
206 | if (mortals.size () >= 512) |
|
|
207 | { |
|
|
208 | static int last_mortalcount; |
|
|
209 | if (mortals.size () != last_mortalcount) |
|
|
210 | { |
|
|
211 | last_mortalcount = mortals.size (); |
207 | LOG (llevInfo, "mortal queue size (%d) exceeds 1000.\n", (int)mortals.size ()); |
212 | LOG (llevInfo, "%d mortals.\n", (int)mortals.size ()); |
|
|
213 | |
|
|
214 | if (0) |
|
|
215 | { |
|
|
216 | for (int j = 0; j < mortals.size (); ++j)//D |
|
|
217 | fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D |
|
|
218 | fprintf (stderr, "\n");//D |
|
|
219 | } |
|
|
220 | } |
|
|
221 | } |
208 | |
222 | |
209 | break; |
223 | break; |
210 | } |
224 | } |
211 | |
225 | |
212 | attachable *obj = mortals [i]; |
226 | attachable *obj = mortals [i]; |
… | |
… | |
241 | //if (self || cb) |
255 | //if (self || cb) |
242 | //INVOKE_OBJECT (CLONE, this, ARG_OBJECT (dst)); |
256 | //INVOKE_OBJECT (CLONE, this, ARG_OBJECT (dst)); |
243 | |
257 | |
244 | attach = src.attach; |
258 | attach = src.attach; |
245 | return *this; |
259 | return *this; |
|
|
260 | } |
|
|
261 | |
|
|
262 | template<typename T> |
|
|
263 | static bool |
|
|
264 | find_backref (void *ptr, T *obj) |
|
|
265 | { |
|
|
266 | char *s = (char *)obj; |
|
|
267 | while (s < (char *)obj + sizeof (T)) |
|
|
268 | { |
|
|
269 | if (ptr == *(void **)s) |
|
|
270 | return true; |
|
|
271 | |
|
|
272 | s += sizeof (void *); // assume natural alignment |
|
|
273 | } |
|
|
274 | |
|
|
275 | return false; |
|
|
276 | } |
|
|
277 | |
|
|
278 | // for debugging, find "live" objects containing this ptr |
|
|
279 | void |
|
|
280 | find_backref (void *ptr) |
|
|
281 | { |
|
|
282 | for_all_objects (op) |
|
|
283 | if (find_backref (ptr, op)) |
|
|
284 | fprintf (stderr, "O %p %d:'%s'\n", op, op->count, &op->name); |
|
|
285 | |
|
|
286 | for_all_players (pl) |
|
|
287 | if (find_backref (ptr, pl)) |
|
|
288 | fprintf (stderr, "P %p\n", pl); |
|
|
289 | |
|
|
290 | for_all_clients (ns) |
|
|
291 | if (find_backref (ptr, ns)) |
|
|
292 | fprintf (stderr, "C %p\n", ns); |
|
|
293 | |
246 | } |
294 | } |
247 | |
295 | |
248 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
296 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
249 | |
297 | |
250 | static SV * |
298 | static SV * |