Skip to content

Commit

Permalink
do not call exit_shogun in java / csharp examples
Browse files Browse the repository at this point in the history
- calling exit_shogun at the end of a java / csharp example is
dangerous: not all shogun objects might have been freed by the garbage
collector at this stage so calling exit_shogun was observed to destroy
essential helper objects that all shogun objects require at runtime
leading to unexpected crashes.
  • Loading branch information
Soeren Sonnenburg committed Dec 16, 2013
1 parent 408843a commit 7230f07
Show file tree
Hide file tree
Showing 212 changed files with 0 additions and 212 deletions.
1 change: 0 additions & 1 deletion examples/undocumented/csharp_modular/MatrixTest.cs
Expand Up @@ -14,6 +14,5 @@ public class MatrixTest
Console.WriteLine(item);
}

modshogun.exit_shogun();
}
}
1 change: 0 additions & 1 deletion examples/undocumented/csharp_modular/VectorTest.cs
Expand Up @@ -12,6 +12,5 @@ public class VectorTest
Console.WriteLine(r[i]);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -28,6 +28,5 @@ public class classifier_averaged_perceptron_modular{
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -23,6 +23,5 @@ public class classifier_gaussiannaivebayes_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -31,6 +31,5 @@ public class classifier_gmnpsvm_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -31,6 +31,5 @@ public class classifier_gpbtsvm_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -24,6 +24,5 @@ public class classifier_knn_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -31,6 +31,5 @@ public class classifier_larank_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -35,6 +35,5 @@ public class classifier_lda_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -31,6 +31,5 @@ public class classifier_liblinear_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -61,6 +61,5 @@ public class classifier_libsvm_minimal_modular {

double testerr=err_num/(2*num);
Console.WriteLine(testerr);
modshogun.exit_shogun();
}
}
Expand Up @@ -32,6 +32,5 @@ public class classifier_libsvm_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -27,6 +27,5 @@ public class classifier_libsvmoneclass_modular {
foreach (double item in out_labels)
Console.Write(item);

modshogun.exit_shogun();
}
}
Expand Up @@ -33,6 +33,5 @@ public class classifier_mpdsvm_modular {
foreach (double item in out_labels)
Console.Write(item);

modshogun.exit_shogun();
}
}
Expand Up @@ -31,6 +31,5 @@ public class classifier_multiclasslibsvm_modular {
foreach (double item in out_labels)
Console.Write(item);

modshogun.exit_shogun();
}
}
Expand Up @@ -31,7 +31,6 @@ public class classifier_perceptron_modular {
foreach (double item in out_labels)
Console.Write(item);

modshogun.exit_shogun();
}
}

Expand Up @@ -16,6 +16,5 @@ public class clustering_hierarchical_modular {
double[] out_distance = hierarchical.get_merge_distances();
int[,] out_cluster = hierarchical.get_cluster_pairs();

modshogun.exit_shogun();
}
}
Expand Up @@ -21,6 +21,5 @@ public class clustering_kmeans_modular {
double[,] out_centers = kmeans.get_cluster_centers();
kmeans.get_radiuses();

modshogun.exit_shogun();
}
}
Expand Up @@ -12,6 +12,5 @@ public class converter_classicisomap_modular {
preprocessor.set_target_dim(1);
preprocessor.apply(features);

modshogun.exit_shogun();
}
}
Expand Up @@ -12,6 +12,5 @@ public class converter_locallylinearembedding_modular {
preprocessor.set_target_dim(1);
preprocessor.apply(features);

modshogun.exit_shogun();
}
}
Expand Up @@ -13,7 +13,6 @@ public class converter_multidimensionalscaling_modular {

mds.apply(features);

modshogun.exit_shogun();
}
}

Expand Up @@ -23,7 +23,6 @@ public class distance_braycurtis_modular {
foreach (double item in dm_test)
Console.Write(item);

modshogun.exit_shogun();

}
}
Expand Up @@ -25,6 +25,5 @@ public class distance_canberra_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -24,7 +24,6 @@ public class distance_chebyshew_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}

Expand Up @@ -24,6 +24,5 @@ public class distance_chisquare_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -24,6 +24,5 @@ public class distance_cosine_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -24,7 +24,6 @@ public class distance_euclidean_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}

Expand Up @@ -25,6 +25,5 @@ public class distance_geodesic_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -33,6 +33,5 @@ public class distance_hammingword_modular {
double[,] dm_train = distance.get_distance_matrix();
distance.init(feats_train, feats_test);
double[,] dm_test = distance.get_distance_matrix();
modshogun.exit_shogun();
}
}
Expand Up @@ -24,6 +24,5 @@ public class distance_jensen_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -42,7 +42,6 @@ public class distance_manhattenword_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}

Expand Up @@ -26,7 +26,6 @@ public class distance_minkowski_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}

Expand Up @@ -26,7 +26,6 @@ public class distance_normsquared_modular {
Console.Write(item);
}

modshogun.exit_shogun();
}
}

Expand Up @@ -27,7 +27,6 @@ public class distance_tanimoto_modular {
}


modshogun.exit_shogun();
}
}

Expand Up @@ -27,6 +27,5 @@ public class distribution_histogram_modular {
//double[,] out_likelihood = histo.get_log_likelihood();
//double out_sample = histo.get_log_likelihood_sample();

modshogun.exit_shogun();
}
}
Expand Up @@ -40,6 +40,5 @@ public class distribution_hmm_modular {
double[] lik_example = hmm.get_log_likelihood();
double lik_sample = hmm.get_log_likelihood_sample();

modshogun.exit_shogun();
}
}
Expand Up @@ -28,6 +28,5 @@ public class distribution_linearhmm_modular {
double[] out_likelihood = hmm.get_log_likelihood();
double out_sample = hmm.get_log_likelihood_sample();

modshogun.exit_shogun();
}
}
Expand Up @@ -46,6 +46,5 @@ public class evaluation_contingencytableevaluation_modular {

Console.Write("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}\n", accuracy, errorrate, bal, wracc, f1, crosscorrelation, recall, precision, specificity);

modshogun.exit_shogun();
}
}
Expand Up @@ -15,6 +15,5 @@ public class features_dense_real_modular {
Console.Write("{0} ", item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -14,7 +14,6 @@ public class features_snp_modular {
sf.load_ascii_file(filename, false, EAlphabet.SNP, EAlphabet.SNP);
SNPFeatures snps = new SNPFeatures(sf);

modshogun.exit_shogun();

}
}
Expand Up @@ -10,6 +10,5 @@ public class features_string_char_modular {
Console.WriteLine(item);
}

modshogun.exit_shogun();
}
}
Expand Up @@ -11,6 +11,5 @@ public class features_string_hashed_wd_modular {
StringByteFeatures f = new StringByteFeatures(EAlphabet.RAWDNA);
HashedWDFeatures y = new HashedWDFeatures(f,start_order,order,from_order,hash_bits);

modshogun.exit_shogun();
}
}
Expand Up @@ -15,6 +15,5 @@ public class features_string_sliding_window_modular {

//f.obtain_by_position_list(8,positions);

modshogun.exit_shogun();
}
}
Expand Up @@ -18,6 +18,5 @@ public class kernel_anova_modular {
kernel.init(feats_train, feats_test);
double[,] km_test = kernel.get_kernel_matrix();

modshogun.exit_shogun();
}
}
1 change: 0 additions & 1 deletion examples/undocumented/csharp_modular/kernel_auc_modular.cs
Expand Up @@ -30,6 +30,5 @@ public class kernel_auc_modular {
Console.Write("\n");
}

modshogun.exit_shogun();
}
}
Expand Up @@ -45,6 +45,5 @@ public class kernel_cauchy_modular {
Console.Write("\n");
}

modshogun.exit_shogun();
}
}
Expand Up @@ -43,7 +43,6 @@ public class kernel_chi2_modular {
Console.Write("\n");
}

modshogun.exit_shogun();
}
}

Expand Up @@ -45,6 +45,5 @@ public class kernel_circular_modular {
Console.Write("\n");
}

modshogun.exit_shogun();
}
}
Expand Up @@ -53,7 +53,6 @@ public class kernel_combined_modular {
kernel.init(feats_train, feats_test);
double[,] km_test=kernel.get_kernel_matrix();

modshogun.exit_shogun();

}
}
Expand Up @@ -37,7 +37,6 @@ public class kernel_comm_ulong_string_modular {
double[,] km_train = kernel.get_kernel_matrix();
kernel.init(feats_train, feats_test);
double[,] km_test = kernel.get_kernel_matrix();
modshogun.exit_shogun();

}
}
Expand Down
Expand Up @@ -39,7 +39,6 @@ public class kernel_const_modular {
Console.Write("\n");
}

modshogun.exit_shogun();
}
}

Expand Up @@ -39,7 +39,6 @@ public class kernel_diag_modular {
Console.Write("\n");
}

modshogun.exit_shogun();
}
}

Expand Up @@ -44,6 +44,5 @@ public class kernel_distance_modular {
}


modshogun.exit_shogun();
}
}

0 comments on commit 7230f07

Please sign in to comment.