mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-24 07:36:24 +01:00
Fix dataset memory leak
This commit is contained in:
parent
df48b92cf2
commit
771d69af20
@ -288,11 +288,26 @@ void train(int dataset_type, char* images_file, char* labels_file, char* data_di
|
|||||||
}
|
}
|
||||||
free(shuffle_index);
|
free(shuffle_index);
|
||||||
free_network(network);
|
free_network(network);
|
||||||
|
|
||||||
#ifdef USE_MULTITHREADING
|
#ifdef USE_MULTITHREADING
|
||||||
free(tid);
|
free(tid);
|
||||||
#else
|
#else
|
||||||
free(train_params);
|
free(train_params);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (dataset_type == 0) {
|
||||||
|
for (int i=0; i < nb_images_total; i++) {
|
||||||
|
for (int j=0; j < 28; j++) {
|
||||||
|
free(images[i][j]);
|
||||||
|
}
|
||||||
|
free(images[i]);
|
||||||
|
}
|
||||||
|
free(images);
|
||||||
|
free(labels);
|
||||||
|
} else {
|
||||||
|
free_dataset(dataset);
|
||||||
|
}
|
||||||
|
|
||||||
end_time = omp_get_wtime();
|
end_time = omp_get_wtime();
|
||||||
elapsed_time = end_time - algo_start;
|
elapsed_time = end_time - algo_start;
|
||||||
printf("\nTemps total: %0.1f s\n", elapsed_time);
|
printf("\nTemps total: %0.1f s\n", elapsed_time);
|
||||||
|
Loading…
Reference in New Issue
Block a user