[ http://issues.apache.org/jira/browse/XERCESC-1358?page=comments#action_59735 ] David Bertoni commented on XERCESC-1358: ----------------------------------------
I've also noticed that many places in the code, people have been careful to provide a prime number as the bucket count for hash tables, presumably for better distribution. However, when the table grows, we multiply the initial hash by 2, which means the bucket count is no longer a prime number. Should we be concerned? I can think if a couple of other choices: 1. choose the first prime number that's less than the original bucket count * 2 (or the first that's greater). 2. extend the HasherBase class to provide the new bucket count. > RefHashTableOf::rehash() is not exception-safe > ---------------------------------------------- > > Key: XERCESC-1358 > URL: http://issues.apache.org/jira/browse/XERCESC-1358 > Project: Xerces-C++ > Type: Bug > Components: Utilities > Versions: 2.6.0 > Environment: All > Reporter: David Bertoni > Attachments: patch.txt > > RefHashTableOf::rehash() modifies its data member in the course of rehashing. > If an exception is thrown during this member function, the object is in an > inconsistent state, which will cause problems when it is destroyed. Also, > there is a chance that memory will leak. > I will provide a patch which does not modify the data members until the > rehashing has complete. It also fixes the potential memory leak. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]