Skip to content

Commit

Permalink
Merge pull request #68 from weblyzard/fix/issue-65
Browse files Browse the repository at this point in the history
fix: Issue #65
  • Loading branch information
AlbertWeichselbraun committed Sep 20, 2022
2 parents 2761ac3 + 72b937f commit 276cdb4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.rst
Expand Up @@ -549,6 +549,21 @@ The following options are available for fine tuning inscriptis' HTML rendering:
text = parser.get_text()
Optimizing memory consumption
-----------------------------
Inscriptis uses the Python lxml library which prefers to reuse memory rather than release it to the operating system. This behavior might lead to an increased memory consumption, if you use inscriptis within a Web service that parses very complex HTML pages.
The following code mitigates this problem on Unix systems by manually forcing lxml to release the allocated memory:
```python
import ctypes
def trim_memory() -> int:
libc = ctypes.CDLL("libc.so.6")
return libc.malloc_trim(0)
```
Citation
========
Expand Down

0 comments on commit 276cdb4

Please sign in to comment.