SRL Archive - S.M.A.R.T.

Slow FPS Drop?


Sin

2013-08-06 13:29:05

Alrighty, so i'm using Brandon's OGL plugin to Fly Fish. When I start SMART, OGL at min settings runs at a smooth 40FPS. However, once the script starts running overtime the FPS drops to 2 (Takes about 2-3 hours). Is the cause of this a memory leak in the script? Or is it SMART itself?

@Brandon @BenLand100

Ashaman88

2013-08-06 14:03:33

I had this problem with some of the older OGL plugins - I think Brandon had said it had to do with RS having a memory leak in OGL mode? I'm not sure if that is the same issue though

Sin

2013-08-06 16:41:51

From: Ashaman88
I had this problem with some of the older OGL plugins - I think Brandon had said it had to do with RS having a memory leak in OGL mode? I'm not sure if that is the same issue though


Dunno but the FPS goes back to normal and starts to drop again when I change the graphics settings.

Brandon

2013-08-06 18:00:25

I won't blame smart but if you don't free Smart at the end of each script, it could leak.

Another thing is that does this happen while you play legit in OpenGL mode or only when you use the plugin? I haven't used anything other than vectors which clean themselves up. At the end of each frame, I do vector.clear(). There isn't anyway to really "leak" a vector at all. I haven't noticed any FPS drops but @DemiseScythe; uses the plugin more than I, so maybe she might have an idea.

Also, are you drawing on Smart using Graphics.Simba? The only possible leak I can actually think of would be the DC used to draw things on. That would only leak if you constantly change graphics modes a ton. However, I do know that jagex does not clean any resource in DirectX and OpenGL. They just leave it so that when the client closes, the OS cleans it up. Doubt that should affect anything though.

Sin

2013-08-06 18:26:05

From: Brandon
I won't blame smart but if you don't free Smart at the end of each script, it could leak.

Another thing is that does this happen while you play legit in OpenGL mode or only when you use the plugin? I haven't used anything other than vectors which clean themselves up. At the end of each frame, I do vector.clear(). There isn't anyway to really "leak" a vector at all. I haven't noticed any FPS drops but @DemiseScythe; uses the plugin more than I, so maybe she might have an idea.

Also, are you drawing on Smart using Graphics.Simba? The only possible leak I can actually think of would be the DC used to draw things on. That would only leak if you constantly change graphics modes a ton. However, I do know that jagex does not clean any resource in DirectX and OpenGL. They just leave it so that when the client closes, the OS cleans it up. Doubt that should affect anything though.


Only legit thing I do on the SMART client is Herb runs and Ports in between botting Fishing using your script. And yeah, the fps does gradually go down while playing legit.
I've been checking the Task manager to see what the memory the SMART uses, and it seems to be steady at around 350-400mb, always.
Nvm, I just checked and it's at 480mb. Ill let you know in 2 hours, which is when i'll get back from my tutor.

Brandon

2013-08-06 18:31:34

From: Sin
Only legit thing I do on the SMART client is Herb runs and Ports in between botting Fishing using your script. And yeah, the fps does gradually go down while playing legit.
I've been checking the Task manager to see what the memory the SMART uses, and it seems to be steady at around 350-400mb, always.
Nvm, I just checked and it's at 480mb. Ill let you know in 2 hours, which is when i'll get back from my tutor.



Ok I'll see if there is something in the client that does this. Perhaps I might have to start deleting textures and buffers when loading a whole new city/area. If the list of found things get extremely large, then I can see why that would happen.

Sin

2013-08-06 18:32:19

From: Brandon
Ok I'll see if there is something in the client that does this. Perhaps I might have to start deleting textures and buffers when loading a whole new city/area. If the list of found things get extremely large, then I can see why that would happen.


Yeah, that might be a reason. Switching from Edgeville (barb) to Port Sarim to Edgeville causes it to lag a bit.

DemiseScythe

2013-08-06 18:34:46

From: Sin
Only legit thing I do on the SMART client is Herb runs and Ports in between botting Fishing using your script. And yeah, the fps does gradually go down while playing legit.
I've been checking the Task manager to see what the memory the SMART uses, and it seems to be steady at around 350-400mb, always.
Nvm, I just checked and it's at 480mb. Ill let you know in 2 hours, which is when i'll get back from my tutor.


I have never experienced this FPS drop nor Memory leaks, I am running a working OGL/RS3 Slayer script with tons of loaded constants and calculations. I get decent resource usage and pretty good FPS on my midrange 435M Nvidia GPU, my GPU is 2GB though so idk if that matters. As for the usage, I got:


I would check the script you are using but I do use SMART 8.2 while you two use the new version. So we really cannot compare.

Brandon

2013-08-06 18:55:24

EDIT: @Sin; Try this. It has the deleters. If your FPS still drops, I can't think of anything else that would cause that. Simply because there isn't anything to delete or clean or leak at all.
[ATTACH=CONFIG]22039[/ATTACH] <– Plugin with deleters. Let me know if it helps with that FPS problem. Otherwise I'll have to view that script you're running and the Smart include. I'm pretty sure I freed all Smart's targets. Only time that Smart won't free it is if you forcefully terminate some script.





I'll sort it out.. I just wrote some deleters for everything. If this works, then it's the plugin. If it does not work, then it is not the plugin and I wasted my time lol.

We'll have to see. The code for any curious eyes:


void Hook_glDeleteBuffers(GLsizei n, const GLuint* buffers)
{
for (int I = 0; I < n; ++I)
{
ModelBuffer::Buffers.erase(std::remove_if(ModelBuffer::Buffers.begin(), ModelBuffer::Buffers.end(), [&](const ModelBuffer &B) {return B.ID == buffers[I];}));
}
ModelBuffer::Buffers.shrink_to_fit();
ptr_glDeleteBuffers(n, buffers);
}

void Hook_glDeleteLists(GLuint list, GLsizei range)
{
for (std::size_t I = list; I < list + range; ++I)
{
Font::Fonts.erase(std::remove_if(Font::Fonts.begin(), Font::Fonts.end(), [&](const Font &F) {return F.ID == I;}));
}
Font::Fonts.shrink_to_fit();
ptr_glDeleteLists(list, range);
}

void Hook_glDeleteTextures(GLsizei n, const GLuint *textures)
{
for (int I = 0; I < n; ++I)
{
Texture::IDMap.erase(Texture::IDMap.find(textures[I]));
Texture::Textures.erase(std::remove_if(Texture::Textures.begin(), Texture::Textures.end(), [&](const Texture &T) {return T.ID == textures[I];}));
}
Texture::Textures.shrink_to_fit();
ptr_glDeleteTextures(n, textures);
}



//In wglGetProcAddress:
if (FunctionCalled == "glDeleteBuffersARB")
{
xDetour(ptr_glDeleteBuffers, ptr_wglGetProcAddress(lpszProc));
return reinterpret_cast<int (__stdcall *)()>(Hook_glDeleteBuffersARB);
}
else if (FunctionCalled == "glDeleteLists")
{
xDetour(ptr_glDeleteLists, ptr_wglGetProcAddress(lpszProc));
return reinterpret_cast<int (__stdcall *)()>(Hook_glDeleteLists);
}
else if (FunctionCalled == "glDeleteTextures")
{
xDetour(ptr_glDeleteTextures, ptr_wglGetProcAddress(lpszProc));
return reinterpret_cast<int (__stdcall *)()>(Hook_glDeleteTextures);
}

Just have to detour them and I'll upload a dll on the official thread.

Sin

2013-08-06 20:51:46

From: Brandon
EDIT: @Sin; Try this. It has the deleters. If your FPS still drops, I can't think of anything else that would cause that. Simply because there isn't anything to delete or clean or leak at all.
[ATTACH=CONFIG]22039[/ATTACH] <– Plugin with deleters. Let me know if it helps with that FPS problem. Otherwise I'll have to view that script you're running and the Smart include. I'm pretty sure I freed all Smart's targets. Only time that Smart won't free it is if you forcefully terminate some script

I'll sort it out.. I just wrote some deleters for everything. If this works, then it's the plugin. If it does not work, then it is not the plugin and I wasted my time lol.

We'll have to see. The code for any curious eyes:


void Hook_glDeleteBuffers(GLsizei n, const GLuint* buffers)
{
for (int I = 0; I < n; ++I)
{
ModelBuffer::Buffers.erase(std::remove_if(ModelBuffer::Buffers.begin(), ModelBuffer::Buffers.end(), [&](const ModelBuffer &B) {return B.ID == buffers[I];}));
}
ModelBuffer::Buffers.shrink_to_fit();
ptr_glDeleteBuffers(n, buffers);
}

void Hook_glDeleteLists(GLuint list, GLsizei range)
{
for (std::size_t I = list; I < list + range; ++I)
{
Font::Fonts.erase(std::remove_if(Font::Fonts.begin(), Font::Fonts.end(), [&](const Font &F) {return F.ID == I;}));
}
Font::Fonts.shrink_to_fit();
ptr_glDeleteLists(list, range);
}

void Hook_glDeleteTextures(GLsizei n, const GLuint *textures)
{
for (int I = 0; I < n; ++I)
{
Texture::IDMap.erase(Texture::IDMap.find(textures[I]));
Texture::Textures.erase(std::remove_if(Texture::Textures.begin(), Texture::Textures.end(), [&](const Texture &T) {return T.ID == textures[I];}));
}
Texture::Textures.shrink_to_fit();
ptr_glDeleteTextures(n, textures);
}



//In wglGetProcAddress:
if (FunctionCalled == "glDeleteBuffersARB")
{
xDetour(ptr_glDeleteBuffers, ptr_wglGetProcAddress(lpszProc));
return reinterpret_cast<int (__stdcall *)()>(Hook_glDeleteBuffersARB);
}
else if (FunctionCalled == "glDeleteLists")
{
xDetour(ptr_glDeleteLists, ptr_wglGetProcAddress(lpszProc));
return reinterpret_cast<int (__stdcall *)()>(Hook_glDeleteLists);
}
else if (FunctionCalled == "glDeleteTextures")
{
xDetour(ptr_glDeleteTextures, ptr_wglGetProcAddress(lpszProc));
return reinterpret_cast<int (__stdcall *)()>(Hook_glDeleteTextures);
}

Just have to detour them and I'll upload a dll on the official thread.


Installed the plugin, will let you know in a bit. Thanks :)

From: DemiseScythe
I have never experienced this FPS drop nor Memory leaks, I am running a working OGL/RS3 Slayer script with tons of loaded constants and calculations. I get decent resource usage and pretty good FPS on my midrange 435M Nvidia GPU, my GPU is 2GB though so idk if that matters. As for the usage, I got:


I would check the script you are using but I do use SMART 8.2 while you two use the new version. So we really cannot compare.


Yeah, thats about the amount of MB the script uses when I start botting :s

Le Jingle

2013-08-07 00:03:15

I don't experience any type of slow FPS drops, using nose-bleed builds too.

Edit: Loading new areas on map, running to random towns, and also teleporting to new areas don't impact FPS in game much if any at all. At least for me.