| 1161 | } |
| 1162 | |
| 1163 | void ManagedBinaryModule::OnUnloaded(MAssembly* assembly) |
| 1164 | { |
| 1165 | PROFILE_CPU(); |
| 1166 | PROFILE_MEM(ScriptingCSharp); |
| 1167 | |
| 1168 | // Clear managed-only types |
| 1169 | Types.Resize(_firstManagedTypeIndex); |
| 1170 | for (int32 i = 0; i < _managedMemoryBlocks.Count(); i++) |
| 1171 | Allocator::Free(_managedMemoryBlocks[i]); |
| 1172 | _managedMemoryBlocks.Clear(); |
| 1173 | |
| 1174 | // Clear managed types information |
| 1175 | for (ScriptingType& type : Types) |
| 1176 | { |
| 1177 | type.ManagedClass = nullptr; |
| 1178 | if (type.Type == ScriptingTypes::Script && type.Script.ScriptVTable) |
| 1179 | { |
| 1180 | Platform::Free(type.Script.ScriptVTable); |
| 1181 | type.Script.ScriptVTable = nullptr; |
| 1182 | } |
| 1183 | } |
| 1184 | #if !COMPILE_WITHOUT_CSHARP |
| 1185 | ClassToTypeIndex.Clear(); |
| 1186 | #endif |
| 1187 | } |
| 1188 | |
| 1189 | const StringAnsi& ManagedBinaryModule::GetName() const |
| 1190 | { |