Your results are not unusual, but that does not mean that everything is wrong. To be compiled, something must prompt the GC to compile (often an attempt). As a result, you can create an application that consumes a bunch of memory, frees it up, and then stays idle. If there is no memory pressure on the machine, and if your application does not try to do something after that, the GC will not work (because it is not necessary). Once you are busy, GC will begin to do its job. This behavior is often mistaken for a leak.
BTW: Do you use this very large array more than once? If so, you might be better off keeping it around and reusing it. Reason: any object larger than 85,000 bytes is allocated in a bunch of large objects. This heap only gets GC'd in Generation 2 collections. Therefore, if you often allocate and redistribute arrays, you will invoke many Gen 2 collections (expensive).
(note: this does not mean that there is a hard and fast rule for reusing large arrays, but if you are doing a lot of allocation / deallocation / allocation of the array, you should measure how much this helps if you are reusing).
source share