[liblouis-liblouisxml] Re: Here's the Python formatter

  • From: "Michael Whapples" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "mwhapples" for DMARC)
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Thu, 17 Dec 2020 07:22:01 +0000

Hello,

Regarding how the table memory gets freed, this is automatically done by the bindings when Python exits. The bindings use the atexit module of Python to register the lou_free function to be called on exit.


Thanks to the Python approach of treating developers as adults, it is possible to call the lou_free function yourself:

import louis

louis.liblouis.lou_free()


I would recommend against doing that though. As said lou_free is called automatically on exit. If you need to free the table memory at some other point I guess you could use the above, although using the liblouis object is probably seen as dealing with implementation details rather than the API. It might be preferrable to request the addition of a function in the bindings API to avoid this direct accessing of implementation details.


Michael Whapples

On 17/12/2020 00:52, John J. Boyer wrote:

Hello Everyone

The Python formatter that I mentioned a few weeks ago is attached. It has a doc 
string that explains its usage.
One thing I'm wondering about is what happens to the memory used by the 
liblouis table when the program ends. I don't see how to clear it.

John

For a description of the software, to download it and links to
project pages go to http://liblouis.org
Donate: http://liblouis.org/sponsoring

Other related posts: