I'm not sure if you're still watching the question, OP, but here's what a Stack Overflow error is, and why the code you presented doesn't show the issue.
(pros: I know this is largely inaccurate, but I'm just trying to get the basic concept out)
So there are two memory "sets" set aside for .Net apps. The Stack and the Heap. The heap is "un-ordered". You never have to worry about the heap unless you're moving VERY large objects around a program.
The stack is ordered by when something is added to it.
[Analogy time]
Think of it as a stack of papers on a desk. Its the 'in progress' pile. In this analogy, you start with a todo list.
The first item is to write a table of contents so you get a new blank sheet and put it on top of the todo list. You can't get back to the tofo list until the task is complete.
Your write the words "Table of Contents" on the paper.
Now you need to add Page 1's title, but there is no page 1 so you have to get another piece of paper. This goes to the top of the "stack" of papers".
Finally you finish page 1 and this is then removed from the top of the stack and you can see the "table of contents" page again.
You happily write down "Page 1: preface" and so on and so on.
When the last item on the todo is complete, it is also removed from the stack. With an empty stack you can shut the office and go home.
This stack it pretty large. You could probably have hundreds of pages on your stack and still be able to write the next item. Remember that each item is removed from the stack when it's completed so the stack usually stays pretty small anyway.
Ok, now - sticking with this analogy let's say that someone made a mistake. The table of contents is actually on Page 1
You get to the table of contents and need to write "Page 1: Table of Contents", but there is no page 1 yet so you get a new piece of paper and write "Table of Contents".
You need to write "Page 1: Table of Contents", but there is no page 1 yet so you get a new piece of paper and write "Table of Contents".
You need to write "Page 1: Table of Contents", but there is no page 1 yet so you get a new piece of paper and write "Table of Contents".
You need to write "Page 1: Table of Contents", but there is no page 1 yet so you get a new piece of paper and write "Table of Contents".
It NEVER ends
eventually you going to get a pile of paper so large that you cannot even reach to add another sheet. Congrats, you have a stack overflow error!
[End of analogy]
So, your 16k records can't cause the error. Each time one is complete it is removed from the stack. this would be like the pages 2-16k. They are only ever the third sheet in my analogy.
Look for recursion. If you have a method that calls itself, or if you can find a loop of methods that end up calling each other in an endless loop then that's your stack overflow. That's your tower of paper toppling over.
I hope that helps.
For more details on heap and stack, there are many resources out there. A good place to get started is with this article:
Six important .NET concepts: Stack, heap, value types, reference types, boxing, and unboxing[
^]
Let me know if you have an questions ^_^
Andy