Валерий Польских wrote:

> Initialization static members PdfTokenizer::m_whitespaceMap and 
> PdfTokenizer::m_delimiterMap
> 
> with this functions (genWsMap() and genDelMap()) results in *memory leaks*.

True. However, in this case there's really no reason to care. Memory 
leaks are a problem where an allocation is performed repeatedly. This 
object is initialized only once.

(If it's being inited more than once, THEN we have a bug, though it's 
not the leak that's the actual bug).

We could use a static character array (in fact, I thought that function 
did) ... but honestly it doesn't actually matter. The 256 bytes get 
allocated either way, and either way they get deallocated when the 
executable terminates.

I guess if you were trying to use podofo on a platform without process 
boundaries you might have problems - but you'd have a LOT more problems 
than that, since PoDoFo (and most libraries) just isn't designed to work 
in that kind of environment.

In any sane environment the worst effect of not freeing that memory is a 
little noise in a memory leak checker. Since any decent ones let you 
provide a suppression list, even that should not be an issue.

For use with memory leak checkers PoDoFo should provide a de-init 
function that can be optionally called by the user before main() exit. 
Right now it doesn't, and I get by quite fine when using (eg) valgrind 
by just adding a couple of suppressions to the list.

--
Craig Ringer

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to