File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ int32_t get_num_physical_cores() {
6060 GetLogicalProcessorInformationEx (RelationAll, nullptr , &length);
6161
6262 // Allocate memory for the buffer
63- buffer = static_cast <SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *>(malloc ( length) );
63+ buffer = reinterpret_cast <SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *>(new char [ length] );
6464
6565 // Things to count
6666 unsigned int physical_cores = 0 ;
@@ -108,10 +108,10 @@ int32_t get_num_physical_cores() {
108108 physical_cores, physical_performance_cores, physical_efficiency_cores,
109109 logical_cores, logical_performance_cores, logical_efficiency_cores);
110110 } else {
111- printf ( " Failed to get processor information. Error: %u\n " , GetLastError ());
111+ fprintf (stderr, " Failed to get processor information. Error: %u\n " , GetLastError ());
112112 }
113113
114- free ( buffer) ;
114+ delete buffer;
115115
116116 if (physical_performance_cores > 0 ) {
117117 return static_cast <int32_t >(physical_performance_cores);
You can’t perform that action at this time.
0 commit comments