MCPcopy Create free account
hub / github.com/creatale/node-dv / FreeClusterer

Function FreeClusterer

deps/tesseract/classify/cluster.cpp:547–563  ·  view source on GitHub ↗

* This routine frees all of the memory allocated to the * specified data structure. It will not, however, free * the memory used by the prototype list. The pointers to * the clusters for each prototype in the list will be set * to NULL to indicate that the cluster data structures no * longer exist. Any sample lists that have been obtained * via calls to GetSamples are no longer valid. *

Source from the content-addressed store, hash-verified

545 * @note History: 6/6/89, DSJ, Created.
546 */
547void FreeClusterer(CLUSTERER *Clusterer) {
548 if (Clusterer != NULL) {
549 memfree (Clusterer->ParamDesc);
550 if (Clusterer->KDTree != NULL)
551 FreeKDTree (Clusterer->KDTree);
552 if (Clusterer->Root != NULL)
553 FreeCluster (Clusterer->Root);
554 // Free up all used buckets structures.
555 for (int d = 0; d < DISTRIBUTION_COUNT; ++d) {
556 for (int c = 0; c < MAXBUCKETS + 1 - MINBUCKETS; ++c)
557 if (Clusterer->bucket_cache[d][c] != NULL)
558 FreeBuckets(Clusterer->bucket_cache[d][c]);
559 }
560
561 memfree(Clusterer);
562 }
563} // FreeClusterer
564
565/**
566 * This routine frees all of the memory allocated to the

Callers

nothing calls this directly

Calls 4

memfreeFunction · 0.85
FreeKDTreeFunction · 0.85
FreeClusterFunction · 0.85
FreeBucketsFunction · 0.85

Tested by

no test coverage detected