Menu

PocketSphinx Freeing

Help
Ralph Kim
2016-06-08
2016-06-08
  • Ralph Kim

    Ralph Kim - 2016-06-08

    Hello,
    I'm looking at the sources for functions ps_free(ps), cmd_ln_free_r(config), ad_close(ad), and fclose(fd). I'm trying to make sure that all of those pointers are properly freed, but so far, I've only found that cmd_ln_free_r actually free what's passed to it, and not just the pointers it contains. Can anyone tell me if I'm supposed to manually free the rest, or if I've just missed them?

     
    • Nickolay V. Shmyrev

      It is not quite clear what are you asking about. You need to explain more. In general, you need to free what you allocated before. All functions listed above properly release corresponding objects. You can use valgrind to check leaks.

       
      • Ralph Kim

        Ralph Kim - 2016-06-08

        Sorry if I worded it badly. For example, if I call ps_free(ps), does this actually free ps? Looking at the source code for ps_free, I see that all of pointers that is referenced by ps, such as ps->config and ps->dict do get freed, but I couldn't pinpoint exactly where ps itself gets freed.

        EDIT: Sorry, I did find it for ps_free. But not for ad_close and fclose.

         

        Last edit: Ralph Kim 2016-06-08
        • Nickolay V. Shmyrev

          ad_close frees the pointer as well, you can look in sphinxbase sources. fclose also frees the pointer, it is a system library call.

           
          • Ralph Kim

            Ralph Kim - 2016-06-08

            Thank you for the quick replies. And sorry about the silly questions.

             

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.