TraverseSchema allocates from the wrong memory manager... ---------------------------------------------------------
Key: XERCESC-1376 URL: http://issues.apache.org/jira/browse/XERCESC-1376 Project: Xerces-C++ Type: Bug Components: Validating Parser (Schema) (Xerces 1.5 or up only) Versions: 2.6.0 Environment: all Reporter: Christian Will Priority: Critical Attachments: TraverseSchema.cpp.patch Hi, TraverseSchema allocates from the wrong memory manager. It creates the DatatypeValidator(...) with the memory manager from the parser instance instead of the grammar pool. Here is a short example how I found this bug. I created 4 memory manager each for platformutils, two paser, and the grammar pool. Both parser are using the same grammar pool. I cached the grammar with the first parser and tried to parse the instance document with the second parser. This should work also if I delete the first parser and the associated memory manager after I load the grammar. But after I deleted the first parser instance I still can see that there is memory allocated with the associated memory manager. And If I delete the memory manager from the first parser and try to parse the instance document with the second parser it crashes. I could locate all of the wrong memory allocations in TraverseSchema.cpp, where we call createDatatypeValidator(...). I changed the parameters that we use the memory manager from the grammar pool. And with my changes we can see that there is no more memory allocated when I delete the first parser and we can parse the instance document with the second parser. (Patch file will be attached.) Regards, Christian Will Original --------------------------------------------------------------------------------------- init... PlatformUtils: 172842 [ 172842]bytes, 2855 [ 3918, 1162]blocks (0) Parser One : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 1214 [ 1214]bytes, 20 [ 20, 0]blocks (0) cache grammar... (T:/testfiles/CROSSWORLDS/schemas/Customer.xsd) PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (2) Parser One : 75950 [ 415896]bytes, 692 [ 3550, 3514]blocks (5) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 692420 [ 1980110]bytes, 9270 [ 18488, 12503]blocks (7) delete parser1... PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (0) Parser One : 49494 [ 415896]bytes, 591 [ 3550, 3618]blocks (0) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 692420 [ 1980110]bytes, 9270 [ 18488, 12503]blocks (0) delete memory manager from parser1!... PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (0) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 692420 [ 1980110]bytes, 9270 [ 18488, 12503]blocks (0) parse with parser2... (T:/testfiles/CROSSWORLDS/data/Customer/Customer.synth_1,228.xml) ...error... --------------------------------------------------------------------------------------- With changes --------------------------------------------------------------------------------------- init... PlatformUtils: 172842 [ 172842]bytes, 2855 [ 3918, 1162]blocks (0) Parser One : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 1214 [ 1214]bytes, 20 [ 20, 0]blocks (0) cache grammar... (T:/testfiles/CROSSWORLDS/schemas/Customer.xsd) PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (2) Parser One : 26456 [ 415896]bytes, 101 [ 2312, 2867]blocks (5) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 741914 [ 2029604]bytes, 9861 [ 19726, 13150]blocks (7) delete parser1... PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (0) Parser Two : 26456 [ 26456]bytes, 101 [ 101, 0]blocks (0) GrammarPool : 741914 [ 2029604]bytes, 9861 [ 19726, 13150]blocks (0) parse with parser2... (T:/testfiles/CROSSWORLDS/data/Customer/Customer.synth_1,228.xml) PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (0) Parser Two : 59074 [ 223634]bytes, 523 [ 580, 227]blocks (39) GrammarPool : 745050 [ 2029604]bytes, 9877 [ 19766, 13174]blocks (6) delete parser2... PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (0) GrammarPool : 745050 [ 2029604]bytes, 9877 [ 19766, 13174]blocks (0) delete grammarPool... PlatformUtils: 173370 [ 173370]bytes, 2868 [ 3933, 1164]blocks (0) terminate PlatformUtils... --------------------------------------------------------------------------------------- -- 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]