On 30 Apr 2022, at 22:35, Martin Mueller wrote:

> When I reported that problem at an earlier time, I think that Stefan advised 
> me to introduce some step that would clear memory after each single text.

How are you reading the source file? If it really is a large file then you 
could do worse than read using iterparse and write using xmlfile.

If you're not using iterpase then clearing elements won't make much difference 
but it does when you use it. But you have to learn when to use it because it's 
easy to use it too aggressively and find it has cleared elements before you've 
processed them. This is especially important where you have recursive functions 
like yours does.

But you should also provide more information about memory use: how much memory 
does your system have and how much memory is the Python process using when it 
crashes.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to