in reply to Re^2: Memory leak in Win32::CtrlGUI?
in thread Memory leak in Win32::CtrlGUI? [SOLVED, sort of]

has not been commented out

That is why I said its plausible. I have vague memories of closures that would leak/stop leaking , randomly, if you added/removed lines

I suspect the problem is with Win32::Setupsup, but that's just an XS shell, leading me to believe the real culprit is in the lower-level C code. (I'm not a C programmer, BTW.)

I tend to agree, given this code hasn't been touched in 10+ years.

I don't see anything obvious in

sub get_property { my $self = shift; my ($property) = @_; return ( $self->get_properties($property) )[0]; } sub get_properties { use DDS; Dump(\@_); my $self = shift; my (@properties) = @_; my %properties = map { $_, "aiaia $_" } @properties; $self->exists or return undef; Win32::Setupsup::GetWindowProperties( $self->handle, \@properties, + \my %properties ) or return undef; }
XS(XS_NT__Setupsup_GetWindowProperties) { dXSARGS; // reset last error LastError(0); // window parameter SV *window = NULL; AV *propToGet = NULL; HV *windowProp = NULL; HV **clearRect = NULL; // check arguments if(items == 3 && SvIOKp(window = ST(0)) && SvROK(propToGet = (AV*) +ST(1)) && SvTYPE(propToGet = (AV*)SvRV(propToGet)) == SVt_PVAV && SvROK(windowProp = (HV*)ST(2)) && SvTYPE(windowProp = (HV*)SvRV(windowProp)) == SVt_PVHV) { // get window handle HWND hWnd = (HWND)SvIV(window); // clear reference clearRect = (HV**)hv_fetch(windowProp, PROP_RECT, strlen(PROP_ +RECT), 0); if(clearRect && *clearRect) hv_clear(*clearRect); clearRect = (HV**)hv_fetch(windowProp, PROP_CLIENT, strlen(PRO +P_CLIENT), 0); if(clearRect && *clearRect) hv_clear(*clearRect); hv_clear(windowProp); for(int count = 0; count <= av_len(propToGet); count++) { SV **curPropToGet = NULL; PSTR curPropToGetName = NULL; int curPropToGetIdx = 0; // look for app. property index if(!(curPropToGet = av_fetch(propToGet, count, 0)) || !(curPropToGetName = SvPV(*curPropToGet, PL_na)) || !(curPropToGetIdx = GetPropertyIndex(curPropToGetName +))) { LastError(UNKNOWN_PROPERTY_ERROR); clearRect = (HV**)hv_fetch(windowProp, PROP_RECT, strl +en(PROP_RECT), 0); if(clearRect && *clearRect) hv_clear(*clearRect); clearRect = (HV**)hv_fetch(windowProp, PROP_CLIENT, st +rlen(PROP_CLIENT), 0); if(clearRect && *clearRect) hv_clear(*clearRect); hv_clear(windowProp); break; } // now get and store the property if(!GetAndStoreWindowProp(hWnd, curPropToGetIdx, P_PERL wi +ndowProp)) { clearRect = (HV**)hv_fetch(windowProp, PROP_RECT, strl +en(PROP_RECT), 0); if(clearRect && *clearRect) hv_clear(*clearRect); clearRect = (HV**)hv_fetch(windowProp, PROP_CLIENT, st +rlen(PROP_CLIENT), 0); if(clearRect && *clearRect) hv_clear(*clearRect); hv_clear(windowProp); break; } } } else croak("Usage: Win32::Setupsup::GetWindowProperties($window, @p +roptoget, " "\\%%windowprop)\n"); RETURNRESULT(!LastError()); }