| 1058 | // this unpatch code around for reference. |
| 1059 | |
| 1060 | void UnpatchWindowsFunctions() { |
| 1061 | // We need to go back to the system malloc/etc at global destruct time, |
| 1062 | // so objects that were constructed before tcmalloc, using the system |
| 1063 | // malloc, can destroy themselves using the system free. This depends |
| 1064 | // on DLLs unloading in the reverse order in which they load! |
| 1065 | // |
| 1066 | // We also go back to the default HeapAlloc/etc, just for consistency. |
| 1067 | // Who knows, it may help avoid weird bugs in some situations. |
| 1068 | main_executable_windows.Unpatch(); |
| 1069 | main_executable.Unpatch(); |
| 1070 | if (libc1.is_valid()) libc1.Unpatch(); |
| 1071 | if (libc2.is_valid()) libc2.Unpatch(); |
| 1072 | if (libc3.is_valid()) libc3.Unpatch(); |
| 1073 | if (libc4.is_valid()) libc4.Unpatch(); |
| 1074 | if (libc5.is_valid()) libc5.Unpatch(); |
| 1075 | if (libc6.is_valid()) libc6.Unpatch(); |
| 1076 | if (libc7.is_valid()) libc7.Unpatch(); |
| 1077 | if (libc8.is_valid()) libc8.Unpatch(); |
| 1078 | } |
| 1079 | #endif |