mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Debug improvements
This commit is contained in:
parent
50e1575b8d
commit
d49b6a46ce
4 changed files with 34 additions and 27 deletions
|
@ -743,35 +743,30 @@ _GSDebugAllocationRemove(Class c, id o)
|
|||
the_table[i].bytes -= bytes;
|
||||
if (the_table[i].num_recorded_objects > 0)
|
||||
{
|
||||
unsigned j, k, n;
|
||||
unsigned j, n;
|
||||
|
||||
n = the_table[i].num_recorded_objects;
|
||||
for (j = 0; j < n; j++)
|
||||
/* Most objects have a brief lifespan. It therefore
|
||||
* makes sense to search from the end of the array back
|
||||
* to the start to maximise the chance of finding an
|
||||
* object quickly.
|
||||
*/
|
||||
j = n = the_table[i].num_recorded_objects;
|
||||
while (j-- > 0)
|
||||
{
|
||||
if ((the_table[i].recorded_objects)[j] == o)
|
||||
{
|
||||
tag = (the_table[i].recorded_tags)[j];
|
||||
while (++j < n)
|
||||
{
|
||||
(the_table[i].recorded_objects)[j - 1] =
|
||||
(the_table[i].recorded_objects)[j];
|
||||
(the_table[i].recorded_tags)[j - 1] =
|
||||
(the_table[i].recorded_tags)[j];
|
||||
}
|
||||
the_table[i].num_recorded_objects--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j < n)
|
||||
{
|
||||
for (k = j + 1; k < n; k++)
|
||||
{
|
||||
(the_table[i].recorded_objects)[k - 1] =
|
||||
(the_table[i].recorded_objects)[k];
|
||||
(the_table[i].recorded_tags)[k - 1] =
|
||||
(the_table[i].recorded_tags)[k];
|
||||
}
|
||||
the_table[i].num_recorded_objects--;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not found - no problem - this happens if the
|
||||
object was allocated before we started
|
||||
recording */
|
||||
;
|
||||
}
|
||||
}
|
||||
unLock();
|
||||
[tag release];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue