aboutsummaryrefslogtreecommitdiff
path: root/build/patch/2010.08-3a339e.patch
blob: 0995bb41c478891a07ecefce371d0ce97694a8b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
commit 3a339ee8ab3a72867fe914ec9c689e1f5a890645
Author: tcurtis <tyler.l.curtis@gmail.com>
Date:   Tue Aug 24 15:52:28 2010 -0500

    Switch objectref_pmc.template to auto_attrs.
    
    Fixes a nasty memory leak that would leak at least 3 scalars per block.
    Now a simple 'while 1 { }' loop seems not to leak anymore.
    
    Signed-off-by: Moritz Lenz <moritz@faui2k3.org>

diff --git a/src/pmc/objectref_pmc.template b/src/pmc/objectref_pmc.template
index d0a8daa..cafc1d2 100644
--- a/src/pmc/objectref_pmc.template
+++ b/src/pmc/objectref_pmc.template
@@ -19,7 +19,7 @@ Forwards all but some methods to the held PMC.
 #include "parrot/parrot.h"
 static STRING *OBJECTREF_str;
 
-pmclass ObjectRef dynpmc group perl6_group manual_attrs {
+pmclass ObjectRef dynpmc group perl6_group auto_attrs {
     ATTR PMC *value;
 
     void class_init() {
@@ -36,10 +36,6 @@ pmclass ObjectRef dynpmc group perl6_group manual_attrs {
     VTABLE void init_pmc(PMC *value) {
         /* Need custom mark and destroy. */
         PObj_custom_mark_SET(SELF);
-        PObj_custom_destroy_SET(SELF);
-
-        /* Create underlying structure. */
-        PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_ObjectRef_attributes);
 
         /* Initialize with an undef PMC if no value. */
         if (PMC_IS_NULL(value))
@@ -56,11 +52,6 @@ pmclass ObjectRef dynpmc group perl6_group manual_attrs {
         }
     }
 
-    VTABLE void destroy() {
-        mem_sys_free(PMC_data(SELF));
-        PMC_data(SELF) = NULL;
-    }
-
     VTABLE PMC * get_pmc() {
         PMC * value;
         GET_ATTR_value(INTERP, SELF, value);