I encounter case when I call a stored procedure for 299166 th times (intensive, i put a non-stop while true loop to call stored procedure) , the following exception will be thrown from PQexec. I am rather sure the exception are from PQexec, as there is a just before cout and just after cout wrap around PQexec. std::cout << "Start PQexec " << sql << std::endl; PGresult *res = PQexec(connection, sql.c_str()); std::cout << "End PQexec " << sql << std::endl; const bool status = (PQresultStatus(res) == PGRES_TUPLES_OK); PQclear(res); "End PQexec..." is not being printed. The last printed message before crashed is : Start PQexec SELECT * FROM insert_unit(1,299166,array[0.407461,0.516022,0.434267 ,0.802882,-1,1.99054,1.99039,0.808687], array['Pad Area','Pad Pitch','Pad Width','Pad Length','Side Pad Pitch','Package X Dimension','Package Y Dimension','Package Z Dimension'], array['mm','mm','mm','mm','mm','mm','mm','mm']) The output is : The thread 'Win32 Thread' (0x264) has exited with code 0 (0x0). First-chance exception at 0x7c812afb in Report.exe: Microsoft C++ exception: std::exception at memory location 0x0012edb4.. First-chance exception at 0x7c812afb in Report.exe: Microsoft C++ exception: std::exception at memory location 0x0012ed94.. First-chance exception at 0x10017ea5 in Report.exe: 0xC0000005: Access violation writing location 0xfeeefeee. 'Report.exe': Unloaded 'C:\WINDOWS\system32\wshtcpip.dll' 'Report.exe': Unloaded 'C:\WINDOWS\system32\hnetcfg.dll' Unhandled exception at 0x10017ea5 in Report.exe: 0xC0000005: Access violation writing location 0xfeeefeee. The call stack is : libpq.dll!10017ea5() [Frames below may be incorrect and/or missing, no symbols loaded for libpq.dll] libpq.dll!1000fa61() > msvcr90d.dll!__set_flsgetvalue() Line 256 + 0xc bytes C msvcp90d.dll!std::clog() + 0x3f bytes C++ Using VC 2008, I break at file tidtable.c _CRTIMP PFLS_GETVALUE_FUNCTION __cdecl __set_flsgetvalue() { #ifdef _M_IX86 PFLS_GETVALUE_FUNCTION flsGetValue = FLS_GETVALUE; <-- BREAK HERE if (!flsGetValue) { flsGetValue = _decode_pointer(gpFlsGetValue); TlsSetValue(__getvalueindex, flsGetValue); } return flsGetValue; #else /* _M_IX86 */ Any suggestion? -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general