--- parser3/src/main/pa_globals.C 2019/12/25 22:13:51 1.204 +++ parser3/src/main/pa_globals.C 2020/12/10 16:38:09 1.209 @@ -29,7 +29,7 @@ extern "C" { #include "ltdl.h" #include "pcre.h" -volatile const char * IDENT_PA_GLOBALS_C="$Id: pa_globals.C,v 1.204 2019/12/25 22:13:51 moko Exp $" IDENT_PA_GLOBALS_H IDENT_PA_SAPI_H; +volatile const char * IDENT_PA_GLOBALS_C="$Id: pa_globals.C,v 1.209 2020/12/10 16:38:09 moko Exp $" IDENT_PA_GLOBALS_H IDENT_PA_SAPI_H; // defines @@ -54,6 +54,8 @@ void pa_register_thread_request(Request& } /// retrives request set by pa_set_request function, useful in contextless places [slow] Request& pa_thread_request() { + if(!thread_request) + throw Exception(0, 0, "request is not initialized"); return *thread_request; } @@ -216,6 +218,15 @@ static void gc_substitute_memory_managem @test hint on one should call this for each thread xmlSubstituteEntitiesDefault(1); */ void pa_globals_init() { + +#ifndef PA_DEBUG_DISABLE_GC + // Dont collect unless explicitly requested. This is quicker (~30% ), + // but less memory-efficient(~8%), so deciding for speed. + GC_dont_gc=1; + // as we log allocation errors, we don't need default gc warnings (without timestamp and URI) + GC_set_warn_proc(GC_ignore_warn_proc); +#endif + // init socks pa_socks_init(); @@ -345,7 +356,6 @@ void pa_dlinit() { // defines for VS2015 to link with gc/xml libs compiled in the previous VS versions #if _MSC_VER >= 1900 #pragma comment(lib,"legacy_stdio_definitions.lib") -extern "C" { FILE _iob[3] = { *stdin, *stdout, *stderr }; } #endif #endif // _MSC_VER