My question is In my c# program (I only have c# code with xaml files) what kinds of object will goes to managed heap and what kinds goes to native heap? And how can I specify the max size of each heap when my application runs? I assume GC only runs on managed heap, is that correctly?
When you create an object using the new operator in C# (or the corresponding operator in any other CLR language), the .NET runtime allocates memory in the "managed heap" (simply a heap managed by the .NET runtime + the garbage collector). This is, in reality, one of two heaps - one meant for objects less then 85K in size and the other for objects larger than this (large arrays and the like). Either way, when such an object is allocated, you don't get back a real pointer describing the address of the allocated space like you would in native code. What you do get back is a "handle", which represents an indirection to that memory address. This indirection exists because the actual memory location may change when the GC collects and compacts the heap.
When you want to talk to unmanaged/native code that expects a pointer, however, you need to use pointers, not handles. .NET provides two methods to convert a .NET handle to a raw pointer that can be passed in to unmanaged code.
I hope this helps!