void uDumpAllStrongRefs(const char *path)
{
    FILE *fp = fopen(path, "w");
    if (!fp)
        return;

    fprintf(fp, "digraph object_dump {\n");

    uEnterCritical();

    for (int i = uHeapObjects->Begin();
         i != uHeapObjects->End();
	 i = uHeapObjects->Next(i))
    {
        uDumpObjectAndStrongRefs(fp, uHeapObjects->GetKey(i));
    }

    uObject ***globalStrongRefs = uGetGlobalStrongRefs();
    const char **globalStrongRefNames = uGetGlobalStrongNames();
    for (int i = 0; globalStrongRefs[i] != NULL && globalStrongRefNames[i] != NULL; ++i)
    {
        uDumpGlobalRef(fp, globalStrongRefs[i], globalStrongRefNames[i]);
    }

    uExitCritical();

    fprintf(fp, "}\n");
    fclose(fp);
}
Exemple #2
0
void uDumpAllStrongRefs(const char* path)
{
    FILE* fp = fopen(path, "w");
    if (!fp)
        return;

    fprintf(fp, "digraph object_dump {\n");
    uEnterCritical();

    for (int i = _HeapObjects->Begin();
         i != _HeapObjects->End();
         i = _HeapObjects->Next(i))
        uDumpObjectAndStrongRefs(fp, _HeapObjects->GetKey(i));

    for (int i = 0; i < _StrongRefs->Length(); i++)
        uDumpGlobalRef(fp, (*_StrongRefs)[i].Value, (*_StrongRefs)[i].Name);

    uExitCritical();
    fprintf(fp, "}\n");
    fclose(fp);
}