pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I free cases generated by procedure??


From: Ben Pfaff
Subject: Re: How do I free cases generated by procedure??
Date: Sat, 14 Oct 2006 16:55:13 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> On Tue, Oct 10, 2006 at 08:35:24AM -0700, Ben Pfaff wrote:
>      John Darrington <address@hidden> writes:
>      
>      > So it seems that RANK has a huge great memory leak here:
>      >
>      >       /* Obtain active file in CF. */
>      >       if (!procedure (NULL, NULL))
>      >         goto error;
>      >
>      > I've tried some obvious ways to fix it, but none of them 
>      > seem to work.
>      >
>      > It's rather worrying, because from what I can make out, the
>      > size of the leak is proportional to the size of the casefile.
>      
>      At first glance the code doesn't have any obvious leaks.
>      I'll try to investigate more closely this weekend, if you like.
>
> I'd be grateful if you would.  I tried to track it down, but got lost
> inside internal_procedure.

Got it.  Here is what I checked in.

By the way, this kind of memory leak appears to originate in the
procedure code because that's where it gets allocated it.  We
just pass everything along with pointers from that point on.

diff -u -p -r1.12 rank.q
--- src/language/stats/rank.q   8 Oct 2006 01:49:15 -0000       1.12
+++ src/language/stats/rank.q   14 Oct 2006 23:52:46 -0000
@@ -626,11 +626,14 @@ rank_sorted_casefile (struct casefile *c
                          dest_idx, dest);
 
               w = 0.0;
+              case_destroy (&group_case);
               case_move (&group_case, &this_case);
             }
          if ( !value_is_missing (mv, this_value) )
            w += c;
+          case_destroy (&this_case);
         }
+      case_destroy (&group_case);
       rank_cases (pos, ULONG_MAX, ultimate_crit, mv, w,
                  rs, n_rank_specs, dest_idx, dest);
     }

-- 
"doe not call up Any that you can not put downe."
--H. P. Lovecraft




reply via email to

[Prev in Thread] Current Thread [Next in Thread]