vtkMaskPoints performs huge allocation when ProportionalMaximumNumberOfPoints is enabled
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The vtkMaskPoints RequestData ends up performing an extremely large allocation at line 381 in some circumstances. The line is:
newPts->Allocate(numNewPts);
numNewPts ends up being VTK_ID_MAX (the highest representable long) for the following reason: when RequestData is invoked, the localMaxPts is reduced to a reasonable amount
localMaxPts = this->MaximumNumberOfPoints > numPts ? numPts : this->MaximumNumberOfPoints;
Immediately after, if ProportionalMaximumNumberOfPoints is enabled, it performs a GetLocalSampleSize request
if(this->ProportionalMaximumNumberOfPoints) { localMaxPts = this->GetLocalSampleSize(numPts, this->InternalGetNumberOfProcesses()); }
which, if the number of processors is one, returns the MaximumNumberOfPoints, which is VTK_ID_MAX.
In my opinion, the localMaxPts normalization should occur after the if, not before.
Present in VTK 7 as well.