View Full Version : memory leak
RavensBro
02-17-2012, 19:11
Hello ok I'll get right to the point how do i go about looking for a memory leak in a plugin well it is my plugin i have no clue where to even start any help would be nice thanks.
RavensBro... that's kinda like taking your car in to the mechanic, dropping the keys off and saying there's something wrong with it, then leaving.
More like phoning your mechanic, saying something is wrong with it, and asking how to fix it.
RavensBro
02-18-2012, 01:24
hmm well then all i know this one guy is running my jetpack plugin on his server and he showed me what it said. that source mod found or deticed a memory leak and so it stop the plugin that is about what i know.
I think you called a Trace and didnīt closed it.......
hmm well then all i know this one guy is running my jetpack plugin on his server and he showed me what it said. that source mod found or deticed a memory leak and so it stop the plugin that is about what i know.
do you have the URL for the plugin the person is using?
RavensBro
02-18-2012, 20:37
http://forums.alliedmods.net/showthread.php?t=176920 i put it out myself but being so new at this i am lost with some of it. i didn't make the plugin myself i just got it working was all where the guy i got it from said it wouldnt work but i did get it to work. thanks
From sdktools_trace.inc:
Ray trace handle, which must be closed via CloseHandle().
your code:
decl Handle:TraceEx;
decl Float:hitPos[3];
decl Float:clientPos[3];
decl Float:targetPos[3];
TraceEx = INVALID_HANDLE;
targetPos[0] = 0.0;
targetPos[1] = 0.0;
targetPos[2] = -4096.0;
GetClientAbsOrigin(iClient, clientPos);
TraceEx = TR_TraceRayFilterEx( clientPos, targetPos, MASK_PLAYERSOLID, RayType_EndPoint, TraceEntityFilterPlayer );
if(TR_DidHit(TraceEx))
TR_GetEndPosition( hitPos, TraceEx );
if( GetVectorDistanceMeter(clientPos, hitPos) <= 1.125 )
fVelocity[2] = 133.33;
else
fVelocity[2] *= (GetConVarFloat(g_JetPackFall));
}
So as I said you didnīt close the handle which will get you the memoryleak.......
RavensBro
02-19-2012, 15:49
ok thanks but I'm not sure how to fix it. I guess I don't follow sorry I don't always under stand some things might take me awhile to sink in lol.
Example usage:
decl Handle:TraceEx;
decl Float:hitPos[3];
decl Float:clientPos[3];
decl Float:targetPos[3];
TraceEx = INVALID_HANDLE;
targetPos[0] = 0.0;
targetPos[1] = 0.0;
targetPos[2] = -4096.0;
GetClientAbsOrigin(iClient, clientPos);
TraceEx = TR_TraceRayFilterEx( clientPos, targetPos, MASK_PLAYERSOLID, RayType_EndPoint, TraceEntityFilterPlayer );
if(TR_DidHit(TraceEx))
{
TR_GetEndPosition( hitPos, TraceEx );
CloseHandle(TraceEx );
}
RavensBro
02-20-2012, 02:16
thank you very much i couldn't have done it with out your help kind sir :)
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.