Re: memory leak (windows 2003, asp.net, sql2000)

From: Pete Beech (peter_beech_at_hotmail.nojunk.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 19:58:26 +0200

Just from looking at the code, the object referenced by arParms shouldn't
have anything referencing it once it goes out of scope - unless something
holds onto it in the Data Access App block function. Surely you wouldn't
need to 'release' these local variables explicitly (also, sqlHelper looks
like its just having a static function invoked on it).

Doesn't the 'using' statement only apply to IDisposable objects (which Array
doesn't implement, AFAIK)? I think you get a compile error if the object
which you apply 'using' to doesn't implement this.

I wonder if something in the Data Access block is holding onto one of the
references passed in.

Pete

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OG9mXpnFEHA.2416@TK2MSFTNGP12.phx.gbl...
> this routine static TQIS_DS.User_PermissionDataTable getSetting
> never releases its memory. You need to release arParms, sqlHelper etc. You
> can use a using construct to release sqlhelper and arparms
>
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "jzink" <anonymous@discussions.microsoft.com> wrote in message
> news:81E6F322-16BC-4538-BE80-3D333D341FA6@microsoft.com...
> > Just implemented a production system using asp.net, iis6, sql2000
running
> on windows2003. Due to the iis6 settings of recyclying worker process
every
> "n" minutes I didn't pick up during testing that there is a memory leak
with
> the app. Narrowing it down even the following code causes a memory leak.
> Any ideas/suggesstions would be greatly appreciated.
> > Memory will creep from 30K to 200K over the span of 24 hours.
> >
> > =========asp page code============
> > private void testDB_Click(object sender, System.EventArgs e)
> > {
> > TQIS_DS.User_PermissionDataTable userPermissions =
> UserPermissions.getSettings(utilities.getNTId());
> > userPermissions.Dispose();
> > userPermissions = null;
> > }
> >
> > ===== data component code==============
> > public static TQIS_DS.User_PermissionDataTable getSettings(string NTId)
> > {
> > TQIS_DS newDS = new TQIS_DS();
> > string[] tableList = new string[1] {"user_permission"};
> > SqlParameter [] arParms = new SqlParameter[1];
> > arParms[0] = new SqlParameter("@ntid", SqlDbType.Char,40);
> > arParms[0].Value = NTId;
> >
>
SqlHelper.FillDataset(ProjectVars.dataSource,"fe_getUserPermissions",newDS,t
> ableList,arParms);
> > return newDS.User_Permission;
> > }
> >
> > ===data access code===
> > standard microsoft data access application block
> >
>
>