At 2014-06-18 18:10:34 +0530, rahilasyed90@gmail.com wrote:
>
> palloc() is disallowed in critical sections and we are already in CS
> while executing this code. So we use malloc().
Are these allocations actually inside a critical section? It seems to me
that the critical section starts further down, but perhaps I am missing
something.
Second, as Andres says, you shouldn't malloc() inside a critical section
either; and anyway, certainly not without checking the return value.
> I am not sure if the change will be a significant improvement from
> performance point of view except it will save few condition checks.
Moving that allocation out of the outer for loop it's currently in is
*nothing* to do with performance, but about making the code easier to
read.
-- Abhijit