I was tracking down a memory leak and found that the curl handle was the source.  I honestly don't know what it's persisting.  In any case, I modified it to close the handle when it's done.  I don't think it will make a difference in performance to close/re-init in this case.
I was tracking down a memory leak and found that the curl handle was the source.  I honestly don't know what it's persisting.  In any case, I modified it to close the handle when it's done.  I don't think it will make a difference in performance to close/re-init in this case.

I'm bulk inserting 1million+ docs, 2000 at a time, and no more memory error.
piotrantosik/Elastica,jeancsil/Elastica,jeancsil/Elastica,im-denisenko/Elastica,p365labs/Elastica,ebernhardson/Elastica,falconavs/Elastica,kartikm/Elastica,ebernhardson/Elastica,webdevsHub/Elastica,idio/elastica,miniplay/Elastica,p365labs/Elastica,Southparkfan/Elastica,stof/Elastica,miniplay/Elastica,vlajos/Elastica,Mosoc/Elastica,eilgin/Elastica,Tobion/Elastica,giorrrgio/Elastica,webdevsHub/Elastica,Gasol/Elastica,tmatei/Elastica,ewgRa/Elastica,Jmoati/Elastica,sugarcrm/Elastica,vend/Elastica,falconavs/Elastica,eilgin/Elastica,Gasol/Elastica,CJGarner/mediawiki-extensions-CirrusSearch-Elastica,pborreli/Elastica,Mosoc/Elastica,ruflin/Elastica,markeilander/Elastica,im-denisenko/Elastica,0x46616c6b/Elastica,vend/Elastica,giovannialbero1992/Elastica,revinate/Elastica,fubuki/Elastica,tmatei/Elastica,Tobion/Elastica,sugarcrm/Elastica,giorrrgio/Elastica,JustinHook/Elastica,kartikm/Elastica,ARAMISAUTO/Elastica,vend/Elastica,Jmoati/Elastica,pborreli/Elastica,markeilander/Elastica,ewgRa/Elastica,splitice/Elastica,revinate/Elastica,ARAMISAUTO/Elastica,vlajos/Elastica,Southparkfan/Elastica,JustinHook/Elastica,idio/elastica,piotrantosik/Elastica,giovannialbero1992/Elastica,fubuki/Elastica,0x46616c6b/Elastica,stof/Elastica,CJGarner/mediawiki-extensions-CirrusSearch-Elastica