Hello everyone, It's been a while since I worked with a low level language such as C++, so I forgot much of the intimate details about how C++ works under the hood.
I'm using a modified version of the below section of code which I got from the API example. I pasted the code I'm referring to below. As you can see near the very bottom, (delete[] symbol;) the pointer variable symbol is being explicitly deleted in order to free up that piece of memory. However, I notice that other pointers that were created are not being explicitly deleted in the same fashion, namely, tesseract::ResultIterator* ri .....and ...... const char* choice. Does this mean that memory is being freed some other way? I'm confused because I thought that native C++ doesn't have garbage collection. I'll be running the below code on a server as part of a web application (crazy, I know) and I wouldn't want my server's memory to eventually get filled up. Excuse the newbie question and thanks! Your help is appreciated. Pix *image = pixRead("/usr/src/tesseract/testing/phototest.tif"); tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI(); api->Init(NULL, "eng"); api->SetImage(image); api->SetVariable("save_blob_choices", "T"); api->SetRectangle(37, 228, 548, 31); api->Recognize(NULL); tesseract::ResultIterator* ri = api->GetIterator(); tesseract::PageIteratorLevel level = tesseract::RIL_SYMBOL; if(ri != 0) { do { const char* symbol = ri->GetUTF8Text(level); float conf = ri->Confidence(level); if(symbol != 0) { printf("symbol %s, conf: %f", symbol, conf); bool indent = false; tesseract::ChoiceIterator ci(*ri); do { if (indent) printf("\t\t "); printf("\t- "); const char* choice = ci.GetUTF8Text(); printf("%s conf: %f\n", choice, ci.Confidence()); indent = true; } while(ci.Next()); } printf("---------------------------------------------\n"); delete[] symbol; } while((ri->Next(level))); } -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscr...@googlegroups.com. To post to this group, send email to tesseract-ocr@googlegroups.com. Visit this group at https://groups.google.com/group/tesseract-ocr. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/40c5b09d-29c9-4c77-8e86-0e25ab76be4b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.