// We distinguish between permanent and mid so we can free Mid and // influence the demotion effect. If Mid is a lot, we will hit // demotion; otherwise they will make into gen2. public MyRequest(int sizePermanent, int sizeMid, bool pinned) { if ((s_count % 32) == 0) { sizePermanent = 1; sizeMid = 1; } mObj = new MidObj[sizeMid]; mObj[0] = new MidObj(s_count, this); obj = new byte[sizePermanent]; FillInPin(obj); _is_pinned = pinned; if (pinned) { pin = GCHandle.Alloc(obj, GCHandleType.Pinned); } s_count++; }