NAME ^

config/auto/gc.pm - Garbage Collection

DESCRIPTION ^

Checks whether the --gc command-line option was passed to Configure.pl and sets the memory allocator accordingly.

--gc can take the values:

gc

The default. Use the memory allocator in src/recources.c.

libc

Use the C library malloc.

malloc

Use the malloc in src/res_lea.c.

malloc-trace

Use the malloc in src/res_lea.c with tracing enabled.

    cc_gen('config/auto/gc/test_c.in');
    eval { cc_build(); };
    my $test = 0;
    unless ($@) {
      $test = cc_run();
    }
    cc_clean();
    # used size should be somewhere here
    unless ($test >= 128 && $test < 155) {
      # if not, use own copy of malloc
      $gc = 'malloc';
    }


parrot