31
Network / sf::SocketTCP::SetBlocking Causes Memory Usage to Skyrocket
« on: April 14, 2010, 07:01:50 pm »
I just tried updating to 1.6, but it didn't work too well.
It still goes up, and when I try to run the executable without going through Code::Blocks (like double clicking the EXE) it says it can't find libgcc_s_dw2-1.dll (like last time I tried to upgrade) (although this time I did try to upgrade the compiler). :roll:
I'm not sure if this helps, but the socket isn't valid before using SetBlocking and afterwards it is.
I've never done it when using graphics either...
I'll just keep testing different things.
EDIT: It goes up at a much slower rate (around 100) when I use Listen first:
It's not valid on test 1 but afterwards it is.
EDIT 2: Changing the order of SetBlocking and Listen doesn't do anything, but if I comment out Listen it goes up fast again.
EDIT 3: SocketUDP does the same thing, except the socket is valid from the start.
It still goes up, and when I try to run the executable without going through Code::Blocks (like double clicking the EXE) it says it can't find libgcc_s_dw2-1.dll (like last time I tried to upgrade) (although this time I did try to upgrade the compiler). :roll:
I'm not sure if this helps, but the socket isn't valid before using SetBlocking and afterwards it is.
Quote from: "Laurent"
QuoteUnrelated note: I just recently noticed that the tutorial for setting SFML up said that if I use it dynamically linked I have to define SFML_DYNAMIC in the project settings... I've never done that before! Laughing When I add it in, it works just the same.
Yep, the linker seems to care only about variables, not functions. If you use the graphics module you'll get some errors.
I've never done it when using graphics either...
I'll just keep testing different things.
EDIT: It goes up at a much slower rate (around 100) when I use Listen first:
Code: [Select]
#include <SFML/Network.hpp>
#include <iostream>
using namespace std;
using namespace sf;
int main()
{
bool isTesting = true;
bool triedOnce = false;
while ( isTesting )
{
sf::SocketTCP *testSocket = new sf::SocketTCP;
if ( !triedOnce )
{
if ( testSocket->IsValid() )
{
cout << "Test 1: Socket is valid." << std::endl;
}
else
{
cout << "Test 1: Socket isn't valid." << std::endl;
}
}
testSocket->Listen( 23132 );
if ( !triedOnce )
{
if ( testSocket->IsValid() )
{
cout << "Test 2: Socket is valid." << std::endl;
}
else
{
cout << "Test 2: Socket isn't valid." << std::endl;
}
}
testSocket->SetBlocking( true );
if ( !triedOnce )
{
if ( testSocket->IsValid() )
{
cout << "Test 3: Socket is valid." << std::endl;
}
else
{
cout << "Test 3: Socket isn't valid." << std::endl;
}
}
delete testSocket;
triedOnce = true;
}
return 0;
}
It's not valid on test 1 but afterwards it is.
EDIT 2: Changing the order of SetBlocking and Listen doesn't do anything, but if I comment out Listen it goes up fast again.
EDIT 3: SocketUDP does the same thing, except the socket is valid from the start.