Skip to content

Commit f837d93

Browse files
Cleanup
1 parent 5009b51 commit f837d93

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

mono/metadata/unity-memory-info.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ IterateMonoInternalHashTable (MonoInternalHashTable *table, gpointer user_data)
6161
for (gint i = 0; i < table->size; i++) {
6262
gpointer head = table->table [i];
6363
while (head) {
64-
MonoClass *klass = head;
64+
MonoClass *klass = (MonoClass *)head;
6565

6666
if (klass->inited)
6767
context->callback(klass, context->user_data);
@@ -71,6 +71,7 @@ IterateMonoInternalHashTable (MonoInternalHashTable *table, gpointer user_data)
7171
}
7272
}
7373

74+
// Report all classes from an assembly
7475
static void
7576
ReportClassesFromAssembly(MonoAssembly *assembly, void *user_data)
7677
{
@@ -95,11 +96,8 @@ ReportClassesFromAssembly(MonoAssembly *assembly, void *user_data)
9596
}
9697
}
9798

98-
/* Some classes are only in this list.
99-
They are added in reflection_setup_internal_class_internal.
100-
*/
99+
// Iterate all classes created with TypeBuilder
101100
list = image->reflection_info_unregister_classes;
102-
103101
while (list) {
104102
MonoClass *klass = (MonoClass *)list->data;
105103

@@ -109,35 +107,45 @@ ReportClassesFromAssembly(MonoAssembly *assembly, void *user_data)
109107
list = list->next;
110108
}
111109

112-
// Iterate all image classes
110+
// Iterate all initialized image classes
111+
// Every created class is in the class_cache
113112
IterateMonoInternalHashTable(&image->class_cache, user_data);
114113

114+
// Iterate all initialized array classes
115115
if (image->array_cache)
116116
g_hash_table_foreach(image->array_cache, ReportHashMapListClasses, user_data);
117117

118+
// Iterate all initialized single-dimention array classes
118119
if (image->szarray_cache)
119120
g_hash_table_foreach(image->szarray_cache, ReportHashMapClass, user_data);
120121

122+
// Iterate all initialized class pointer classes
121123
if (image->ptr_cache)
122124
g_hash_table_foreach(image->ptr_cache, ReportHashMapClass, user_data);
123125
}
124126

127+
// Report all classes in image sets which contain generic instances.
125128
static void
126129
ReportImageSetClasses(MonoImageSet *imageSet, void* user_data)
127130
{
131+
// Generic class instances
128132
if (imageSet->gclass_cache)
129133
mono_conc_hashtable_foreach(imageSet->gclass_cache, ReportGenericClass, user_data);
130134

135+
// Generic array class instances
131136
if (imageSet->array_cache)
132137
g_hash_table_foreach(imageSet->array_cache, ReportHashMapListClasses, user_data);
133138

139+
// Generic single dimention array (SZArray) class instances
134140
if (imageSet->szarray_cache)
135141
g_hash_table_foreach(imageSet->szarray_cache, ReportHashMapClass, user_data);
136142

143+
// Generic class pointer instances
137144
if (imageSet->ptr_cache)
138145
g_hash_table_foreach(imageSet->ptr_cache, ReportHashMapClass, user_data);
139146
}
140147

148+
// Report all initialized classes in the current domain.
141149
MONO_API void
142150
mono_unity_class_for_each(ClassReportFunc callback, void *user_data)
143151
{
@@ -149,14 +157,3 @@ mono_unity_class_for_each(ClassReportFunc callback, void *user_data)
149157
// Report all image set arrays which include generic classes
150158
mono_metadata_image_set_foreach(ReportImageSetClasses, &reportContext);
151159
}
152-
153-
MONO_API MonoManagedMemorySnapshot*
154-
mono_unity_capture_memory_snapshot()
155-
{
156-
return NULL;
157-
}
158-
159-
MONO_API void
160-
mono_unity_free_captured_memory_snapshot(MonoManagedMemorySnapshot* snapshot)
161-
{
162-
}

mono/metadata/unity-memory-info.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@ typedef void(*ClassReportFunc) (MonoClass* klass, void *user_data);
66

77
MONO_API void mono_unity_class_for_each(ClassReportFunc callback, void* user_data);
88

9-
typedef struct MonoManagedMemorySnapshot MonoManagedMemorySnapshot;
10-
MONO_API MonoManagedMemorySnapshot* mono_unity_capture_memory_snapshot();
11-
MONO_API void mono_unity_free_captured_memory_snapshot(MonoManagedMemorySnapshot* snapshot);
12-
139
#endif

0 commit comments

Comments
 (0)