[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gettext.c patch: reuse memory
From: |
Carles Pina i Estany |
Subject: |
gettext.c patch: reuse memory |
Date: |
Sun, 29 Nov 2009 00:49:50 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hello,
This week I realised of a quite big mistake in the gettext module. Every
time that the user of this module was asking for string translation,
gettext module was allocating new memory and returning it. So if the
user was asking 10 times for the same string, gettext was creating 10
new strings and leaking memory.
With the attached patch, gettext module saves in a list the
translations. So if a user asks again for the same translation it
returns the same pointer to the already allocated string instead of a
new one.
If someone wants to discuss things maybe in the IRC is better (but feel
free to talk it here too). There are different approaches, and the
current one is not perfect but I don't see any perfect design.
Reviewers of the patch?
Thanks,
--
Carles Pina i Estany
http://pinux.info
ChangeLog.memory
Description: Text document
gettext_memory.patch
Description: Text Data
- gettext.c patch: reuse memory,
Carles Pina i Estany <=