From: Pavan D. <pav...@gm...> - 2013-08-06 04:11:46
|
On Tue, Aug 6, 2013 at 9:34 AM, Nikhil Sontakke <ni...@st...> wrote: > Me and Andrei looked at the code a bit. Other things look ok in general. > > Again the use of defines in gtm.h like: > > #define TopMemoryContext (GetMyThreadInfo->thr_thread_context) > > make me nervous. This can cause issues in the future as well. As an > example, the following code in GTM_ThreadCreate: > > One of the reasons why I chose to do it this way is to reduce the impact on the code that I borrowed heavily from Postgres and turned it into multi-threaded architecture. Thats why we also see something like TopMostMemoryContext. I wanted to emulate thread as a process, but a few things were required to be at process level. > thrinfo->thr_error_context = AllocSetContextCreate(ErrorContext, > > The comment above this line says > > /* > * Each thread gets its own ErrorContext and its a child of > ErrorContext of > * the main process > */ > > However due to the inclusion of gtm.h, ErrorContext becomes a macro and > expands to GetMyThreadInfo->thr_error_context which should be NULL! > > However the code is careful to track and release contexts AFAICS. But we > need to be mindful of this in the future as well. > > Will check that code. Thanks, Pavan |