このページを編集する際は,編集に関する方針に従ってください.
概要
- gcc-4.1.0/gcc/ggc-zone.cにて定義
- ゾーン割り当て構造体
実装
379 /* A zone allocation structure. There is one of these for every
380 distinct allocation zone. */
381 struct alloc_zone
382 {
383 /* The most recent free chunk is saved here, instead of in the linked
384 free list, to decrease list manipulation. It is most likely that we
385 will want this one. */
386 char *cached_free;
387 size_t cached_free_size;
388
389 /* Linked lists of free storage. Slots 1 ... NUM_FREE_BINS have chunks of size
390 FREE_BIN_DELTA. All other chunks are in slot 0. */
391 struct alloc_chunk *free_chunks[[[NUM_FREE_BINS]] + 1];
392
393 /* The highest bin index which might be non-empty. It may turn out
394 to be empty, in which case we have to search downwards. */
395 size_t high_free_bin;
396
397 /* Bytes currently allocated in this zone. */
398 size_t allocated;
399
400 /* Linked list of the small pages in this zone. */
401 struct small_page_entry *pages;
402
403 /* Doubly linked list of large pages in this zone. */
404 struct large_page_entry *large_pages;
405
406 /* If we are currently marking this zone, a pointer to the mark bits. */
407 mark_type *mark_bits;
408
409 /* Name of the zone. */
410 const char *name;
411
small pageの数
412 /* The number of small pages currently allocated in this zone. */
413 size_t n_small_pages;
414
415 /* Bytes allocated at the end of the last collection. */
416 size_t allocated_last_gc;
417
418 /* Total amount of memory mapped. */
現在どの程度マップしているか
419 size_t bytes_mapped;
420
421 /* A cache of free system pages. */
422 struct small_page_entry *free_pages;
423
424 /* Next zone in the linked list of zones. */
425 struct alloc_zone *next_zone;
426
427 /* True if this zone was collected during this collection. */
428 bool was_collected;
429
430 /* True if this zone should be destroyed after the next collection. */
431 bool dead;
432
433 #ifdef GATHER_STATISTICS
434 struct
435 {
436 /* Total memory allocated with ggc_alloc. */
437 unsigned long long total_allocated;
438 /* Total overhead for memory to be allocated with ggc_alloc. */
439 unsigned long long total_overhead;
440
441 /* Total allocations and overhead for sizes less than 32, 64 and 128.
442 These sizes are interesting because they are typical cache line
443 sizes. */
444
445 unsigned long long total_allocated_under32;
446 unsigned long long total_overhead_under32;
447
448 unsigned long long total_allocated_under64;
449 unsigned long long total_overhead_under64;
450
451 unsigned long long total_allocated_under128;
452 unsigned long long total_overhead_under128;
453 } stats;
454 #endif
455 } &color(Silver){main_zone};;