That's great, Thanks Mark! Is there a way to set the upper bound of the recursion of libxml? Giovanni
On Fri, Jul 10, 2009 at 1:28 PM, Mark Rowe <[email protected]> wrote: > > On 2009-07-10, at 10:53, Giovanni Donelli wrote: > > Hi Daniel, >> thanks for the response. I did some additional debugging and I verified >> that the crash doesn't occur on the main thread, but is 100% reproducible on >> secondary thread. This explains why you cannot reproduce it with xmllint. >> > > One thing to be aware of is that background threads often default to a much > smaller stack size than the main thread. When combined with libxml2's use > of recursion during parsing, this can lead to the stack being blown when > parsing a deeply-nested document. libxml2 has some built-in limits to try > and avoid recursing too deeply, but these limits have no knowledge of the > size of the stack on the thread doing the parsing and also don't take in to > account any stack space used outside of libxml2. > > If I tweak your code below to create the thread like so: > > pthread_attr_t attr; > pthread_attr_init(&attr); > pthread_attr_setstacksize(&attr, 1024 * 1024); > > pthread_t thread; > if (pthread_create(&thread, &attr, _thread, NULL)) { > > Then there is sufficient space to parse the document without running off > the end of the stack. > > Hope this helps, > > - Mark > >
_______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
