Lines Matching refs:GC
58 // Track total time spent preparing for GC,
108 alias GC gc_t;
110 /* ============================ GC =============================== */
112 // register GC in C constructor (_STI_)
125 private GC initialize()
136 private GC initialize_precise()
142 class ConservativeGC : GC
155 * Lock the GC.
167 * Initialize the GC based on command line configuration.
170 * OutOfMemoryError if failed to initialize GC due to not enough memory.
193 //debug(PRINTF) printf("GC.Dtor()\n");
209 * Enables the GC if disable() was previously called. Must be called
210 * for each time disable was called in order to enable the GC again.
224 * Disable the GC. The GC may still run if it deems necessary.
366 * If p was not allocated by the GC, points inside a block, or is null, no
409 * If p was not allocated by the GC, points inside a block, or is null, no
490 printf("GC::malloc(gcx = %p, size = %d bits = %x, ti = %s)\n", gcx, size, bits, debugTypeName(ti).ptr);
570 * Request that the GC reallocate a block of memory, attempting to adjust
573 * If p was not allocated by the GC, points inside a block, or is null, no
622 debug(PRINTF) printf("GC::realloc(p = %p, size = %llu)\n", p, cast(ulong)size);
757 debug(PRINTF) printf("GC::extend(p = %p, minsize = %zu, maxsize = %zu)\n", p, minsize, maxsize);
838 * If p was not allocated by the GC, points inside a block, is null, or
1123 * p = A pointer into a GC-managed memory block or null.
1141 * p = A pointer into a GC-managed memory block or null.
1251 debug(PRINTF) printf("GC.fullCollect()\n");
1303 core.memory.GC.Stats stats() @safe nothrow @nogc
1313 core.memory.GC.ProfileStats profileStats() nothrow @trusted
1336 private void getStatsNoSync(out core.memory.GC.Stats stats) @trusted nothrow @nogc
1550 printf("\tTotal GC prep time: %lld milliseconds\n",
1559 printf("\tGrand total GC time: %lld milliseconds\n", gcTime);
1584 printf("GC summary:%5lld MB,%5lld GC%5lld ms, Pauses%5lld ms <%5lld ms%s\n",
2260 * Search a range of memory values and mark any pointers into the GC pool.
2880 // process GC marks then sweep
2912 // (unless they allocate or use the GC themselves, in which case
2913 // the global GC lock will stop them).
3122 // If we get here with the forking GC, the child process has finished the marking phase
3214 // A fork might happen while GC code is running in a different thread.
3215 // Because that would leave the GC in an inconsistent state,
3216 // make sure no GC code is running by acquiring the lock here,
3218 // This must not happen if fork is called from the GC with the lock already held
3340 // If the GC is called by module ctors no explicit
3341 // import dependency on the GC is generated. So the
3342 // GC module is not correctly inserted into the module
3389 assert(sigmask_rc == 0, "failed to set up GC scan thread sigmask");
3398 assert(sigmask_rc == 0, "failed to set up GC scan thread sigmask");
3510 GCBits is_pointer; // precise GC only: per-word, not per-block like the rest of them (SmallObjectPool only)
3544 // precise GC: TypeInfo.rtInfo for allocation (LargeObjectPool only)
3571 //debug(PRINTF) printf("GC fail: poolsize = x%zx, errno = %d\n", poolsize, errno);
4030 // without notifying the GC
4444 import core.memory : GC;
4450 GC.free(buf); // ignored in finalizer
4455 new Foo(GC.malloc(10));
4456 GC.collect();
4461 import core.memory : GC;
4468 GC.removeRange(ptr);
4469 GC.removeRoot(ptr);
4474 GC.addRoot(buf.ptr);
4475 GC.addRange(buf.ptr, buf.length);
4477 GC.collect();
4565 name = si.mangledName; // .name() might GC-allocate, avoid deadlock
4799 // pre-sentinel must be smaller than 16 bytes so that the same GC bits
4883 auto p = cast(size_t*)GC.malloc(size_t.sizeof*3);
4886 GC.free(p);
4894 auto p = cast(ubyte*)GC.malloc(1);
4906 GC.removeRoot(null);
4907 GC.removeRoot(cast(void*)13);
4916 auto p = GC.malloc(260 << 20); // new pool has 390 MB
4917 auto q = GC.malloc(65 << 20); // next chunk (larger than 64MB to ensure the same pool is used)
4918 auto r = GC.malloc(65 << 20); // another chunk in same pool
4921 GC.free(q);
4923 GC.collect();
4925 size_t sz = GC.extend(p, 64 << 20, 66 << 20); // trigger size after p large enough (but limited)
4927 GC.free(p);
4928 GC.free(r);
4931 p = GC.malloc(70 << 20); // from the same pool
4932 q = GC.malloc(70 << 20);
4933 r = GC.malloc(70 << 20);
4934 auto s = GC.malloc(70 << 20);
4935 auto t = GC.malloc(70 << 20); // 350 MB of 390 MB used
4940 GC.free(r); // ensure recalculation of largestFree in nxxt allocPages
4941 auto z = GC.malloc(75 << 20); // needs new pool
4943 GC.free(p);
4944 GC.free(q);
4945 GC.free(s);
4946 GC.free(t);
4947 GC.free(z);
4948 GC.minimize(); // release huge pool
4965 GC.collect();
4966 GC.minimize();
4967 auto stats = GC.stats();
4968 auto ptr = GC.malloc(sz, BlkAttr.NO_SCAN);
4969 auto info = GC.query(ptr);
4972 GC.free(ptr);
4973 GC.minimize();
4974 auto nstats = GC.stats();
4989 assert(GC.getAttr(p) == BlkAttr.NO_SCAN);
4990 assert(GC.setAttr(p + 4, BlkAttr.NO_SCAN) == 0); // interior pointer should fail
4991 assert(GC.clrAttr(p + 4, BlkAttr.NO_SCAN) == 0); // interior pointer should fail
4992 GC.free(p);
4993 assert(GC.query(p).base == null);
4994 assert(GC.query(p).size == 0);
4995 assert(GC.addrOf(p) == null);
4996 assert(GC.sizeOf(p) == 0); // fails
4997 assert(GC.getAttr(p) == 0);
4998 assert(GC.setAttr(p, BlkAttr.NO_SCAN) == 0);
4999 assert(GC.clrAttr(p, BlkAttr.NO_SCAN) == 0);
5001 void* large = GC.malloc(10000, BlkAttr.NO_SCAN);
5004 void* small = GC.malloc(100, BlkAttr.NO_SCAN);
5013 GC.ProfileStats stats1 = GC.profileStats();
5014 GC.collect();
5015 GC.ProfileStats stats2 = GC.profileStats();
5032 auto o = GC.malloc(10);
5033 auto p = (cast(void**)GC.malloc(4096 * (void*).sizeof))[0 .. 4096];
5034 auto q = (cast(void**)GC.malloc(4096 * (void*).sizeof))[0 .. 4096];
5040 auto nq = (cast(void**)GC.realloc(q.ptr, 4000 * (void*).sizeof))[0 .. 4000];
5044 GC.free(q.ptr);
5046 auto np = (cast(void**)GC.realloc(p.ptr, 4200 * (void*).sizeof))[0 .. 4200];