It accepts a process handle as a parameter, so with the correct access flags you could read the memory of the other process and do real time comparisons. You could also simply use CreateRemoteThreadEx(), shared memory segments, or message loops. It really depends on what you're trying to do.
Other than during execution, you said yourself you have no idea how much would be dynamically allocated, so it likely is not possible to know before run time. If the algorithm is purely internal mathematics, it may have a maximum value anyway, in which case you would simply use the size of the object you are allocating, plus overhead, and multiply by the maximum size of the array to get a reasonable estimate of the total memory in bytes that will be added to the heap.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...