<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Immer mehr private bytes :(]]></title><description><![CDATA[<p>Hallo!</p>
<p>Könnt ihr mir verraten, warum mein Programm immer mehr private bytes belegt?<br />
Zu Beginn sind es 644K, nach etwa 8 Stunden Laufzeit sind es 3MB geworden.</p>
<p>Dabei lösche ich doch alle 10 Sekunden mit UpdateOld() alle Arrays, vectoren...Ich verstehe es nicht! Vielleicht findet ihr da was?</p>
<pre><code class="language-cpp">#ifndef INCLUDED_SLOWBOB
#define INCLUDED_SLOWBOB

//// &lt; I N C L U D E S &gt; /////////////////////////
#include &lt;windows.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;
#include &quot;soci.h&quot;
#include &quot;soci-mysql.h&quot;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
class SlowBob
{
	HWND hWnd;
	HWND edit;
	HWND list;

	LRESULT itemCount;

	std::string windowTitle;

	TCHAR        recvText[128];
	std::string  s;

	std::string kickText;

	short oldJoinedPlayers;
	short joinedPlayers;
	short bannedPlayers;

	struct oldJoinedPlayer
	{
		std::string ip;
		std::string id;
	}; oldJoinedPlayer oldJoinedPlayer[64];

	struct joinedPlayer
	{
		std::string ip;
		std::string id;
	}; joinedPlayer joinedPlayer[64];

	struct bannedPlayer
	{
		std::string ip;
	}; bannedPlayer bannedPlayer[1000];

	std::ifstream  config;
	std::ifstream  banned;
	std::ifstream  mySql;
	std::string    row;

	bool mode;

	std::vector&lt;std::string&gt; configRow;
	std::vector&lt;std::string&gt; bannedRow;
	std::vector&lt;std::string&gt; mySqlRow;

	std::vector&lt;std::string&gt; kickList;

	float interval;
	float current;
	float elapsed;
	float old;
public:
	SlowBob();
	~SlowBob();

	void Tick();
	void Check();
	void Kick();
	void UpdateOld();

	void getJoinedPlayers();
	void getJoinedPlayerIds();
	void getJoinedPlayerIps();
	void getBannedPlayerIpsTXT();
	void getBannedPlayerIpsSQL();

	void sendText(std::string);
	void kickPlayer(std::string);
};

#endif // INCLUDED_SLOWBOB
</code></pre>
<pre><code class="language-cpp">//// &lt; I N C L U D E S &gt; /////////////////////////
#include &quot;SlowBob.h&quot;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
SlowBob::SlowBob()
{
	config.open(&quot;config.txt&quot;);

	// We need this file
	if(!config.is_open())
	{
		MessageBox(NULL, &quot;Open config.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	// Read out all rows
	while(std::getline(config, row))
	{
		configRow.push_back(row);
	}

	// Textfile mode
	if(configRow[1] == &quot;TXT&quot;)
		mode = 0;
	// SQL database mode
	else
		mode = 1;

	windowTitle   = configRow[0];
	interval      = (float)atoi(configRow[2].c_str());
	if(interval &lt; 1.0)
		interval = 1.0f;
	kickText      = configRow[3];

	// Current last row + 1
	itemCount = 99;

	// Get handles of vcded- window, its listbox and edit- field
	hWnd = FindWindow(0, windowTitle.c_str());

	if(hWnd == NULL)
	{
		MessageBox(NULL, &quot;Window not found. Check server name!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	edit = FindWindowEx(hWnd, 0, &quot;Edit&quot;, 0);
	list = FindWindowEx(hWnd, 0, &quot;ListBox&quot;, 0);

	// Set to 0
	elapsed  = 0.0f;
	old      = 0.0f;

	bannedPlayers = 0;

	memset(&amp;oldJoinedPlayer, 0, sizeof(oldJoinedPlayer));
	memset(&amp;joinedPlayer, 0, sizeof(joinedPlayer));
	memset(&amp;bannedPlayer, 0, sizeof(bannedPlayer));
	memset(&amp;recvText, 0, sizeof(recvText));

	// Just spam a little so that we can begin with 99 rows, not very elegant
	for(int a = 0; a &lt; 50; a++)
		sendText(&quot;fillup&quot;);
}

SlowBob::~SlowBob()
{
	config.close();
}

void SlowBob::Tick()
{
	// Calculate elapsed time
	current  = timeGetTime() / 1000.0f;
	elapsed  += (current - old);
	old      = timeGetTime() / 1000.0f;

	if(elapsed &gt;= interval)
	{
		getJoinedPlayers();
		getJoinedPlayerIds();
		getJoinedPlayerIps();

		if(mode)
			getBannedPlayerIpsSQL();
		else
			getBannedPlayerIpsTXT();

		Check();

		if(kickList.size() &gt; 0)
			Kick();

		UpdateOld();

		elapsed = 0.0f;
	}

	Sleep(1);
}

void SlowBob::Check()
{
	// For every joined player
	for(int a = 0; a &lt; joinedPlayers; a++)
	{
		// For every banned player
		for(int b = 0; b &lt; bannedPlayers; b++)
		{
			// If joined player and banned player IP is the same
			if(!strcmp(joinedPlayer[a].ip.c_str(), bannedPlayer[b].ip.c_str()))
			{
				//if(b == (bannedPlayers - 1))
					// Add him to kick list
					kickList.push_back(joinedPlayer[a].id);
			}
			//else
				//b = bannedPlayers - 1;
		}
	}
}

void SlowBob::Kick()
{
	sendText(&quot;say \&quot;{SlowBob} &quot; + kickText + &quot;\&quot;&quot;);
	Sleep(1000);

	// For every player in kick- list
	for(unsigned int a = 0; a &lt; kickList.size(); a++) 
		kickPlayer(kickList[a]);

	kickList.clear();
}

void SlowBob::UpdateOld()
{
	memset(&amp;oldJoinedPlayer, 0, sizeof(oldJoinedPlayer));

	// Save checked players for the next rounds to spare playerip commands
	for(int a = 0; a &lt; 64; a++)
	{
		oldJoinedPlayer[a].ip = joinedPlayer[a].ip;
		oldJoinedPlayer[a].id = joinedPlayer[a].id;
	}

	oldJoinedPlayers = joinedPlayers;

	memset(&amp;joinedPlayer, 0, sizeof(joinedPlayer));
	memset(&amp;bannedPlayer, 0, sizeof(bannedPlayer));
	memset(&amp;recvText, 0, sizeof(recvText));

	configRow.clear();
	bannedRow.clear();
	mySqlRow.clear();
}

void SlowBob::getJoinedPlayers()
{
	sendText(&quot;list&quot;);
	Sleep(1000);

	// Receive last row
	SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
	s = recvText;

	// If &quot;Total players:&quot; not found, jump a row higher and read out again
	while(s.find(&quot;Total players:&quot;) == std::string::npos)
	{
		itemCount--;
		SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
		s = recvText;
	}

	// Save total players
	joinedPlayers = atoi((s.substr(15).c_str()));
}

void SlowBob::getJoinedPlayerIds()
{
	// For every joined player
	for(int a = 2, b = joinedPlayers - 1; a &lt;= (joinedPlayers + 1), b &gt;= 0; a++, b--)
	{
		// Get the row one above &quot;Total players:&quot; to begin readin' out player ID's
		SendMessage(list, LB_GETTEXT, itemCount - a, (LPARAM)recvText);
		s = recvText;

		// If &quot;ping&quot; is not found, it cannot be the right row
		while(s.find(&quot;ping&quot;) == std::string::npos)
		{
			itemCount--;
			SendMessage(list, LB_GETTEXT, itemCount - a, (LPARAM)recvText);
			s = recvText;
		}

		size_t pos = s.find(&quot;]&quot;);

		// Cut out the string from &quot;[&quot; + 1 till &quot;]&quot; - 1
		joinedPlayer[b].id  = s.substr(1, pos - 1);

		itemCount = 99;
	}
}

void SlowBob::getJoinedPlayerIps()
{
	// For every joined player
	for(int a = 0; a &lt; joinedPlayers; a++)
	{
		// For every old joined player
		for(int b = 0; b &lt; oldJoinedPlayers; b++)
		{
			// If the player got checked already
			if(joinedPlayer[a].id == oldJoinedPlayer[b].id)
				joinedPlayer[a].ip = oldJoinedPlayer[b].ip;
		}

		if(strlen(joinedPlayer[a].ip.c_str()) &lt; 7)
		{
			sendText(&quot;playerip &quot; + joinedPlayer[a].id);
			Sleep(500);

		    SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
			s = recvText;

			// If all these strings are not found, we are definitely in the wrong row
			while(s.find(&quot;player #&quot;) == std::string::npos 
			   &amp;&amp; s.find(&quot;]error:&quot;) == std::string::npos 
			   &amp;&amp; s.find(&quot;playerip failed&quot;) == std::string::npos)
			{
				itemCount--;
				SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
				s = recvText;
			}

			if(s.find(&quot;playerip failed&quot;) != std::string::npos)
			{
				sendText(&quot;say \&quot;{SlowBob} Could not seek IP. Penalty: Kick\&quot;&quot;);
				Sleep(2000);
				kickPlayer(joinedPlayer[a].id);
			}
			// Finally, if we got the right row, save the god damned IP
			else if(s.find(&quot;player #&quot;) != std::string::npos)
				joinedPlayer[a].ip  = s.substr(s.find(&quot;:&quot;) + 2);
		}

		itemCount = 99;
	}
}

void SlowBob::getBannedPlayerIpsTXT()
{
	banned.open(&quot;banned.txt&quot;);

	if(!banned.is_open())
	{
		MessageBox(NULL, &quot;Open banned.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	while(std::getline(banned, row))
	{
		bannedRow.push_back(row);
		bannedPlayers++;
	}

	for(unsigned int a = 0; a &lt; bannedRow.size(); a++) 
		bannedPlayer[a].ip = bannedRow[a];

	banned.close();
}

void SlowBob::getBannedPlayerIpsSQL()
{
	mySql.open(&quot;sql.txt&quot;);

	if(!mySql.is_open())
	{
		MessageBox(NULL, &quot;Open sql.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	// SOCI::BackEndFactory const &amp;backEnd = SOCI::mysql;
	// SOCI::Session session(backEnd, &quot;service=mydb user=john password=secret&quot;);

	// session &lt;&lt; &quot;Select&quot;;

	mySql.close();
}

void SlowBob::sendText(std::string text)
{
	// Sends a string to the edit- field
	SendMessage(edit, WM_SETTEXT, 0, (LPARAM)text.c_str());
	// Don' t forget to simulate a keystroke
	SendMessage(edit, WM_KEYDOWN, VK_RETURN, 0);
}

void SlowBob::kickPlayer(std::string id)
{
	sendText(&quot;kick &quot; + id);
	Sleep(200);
}
</code></pre>
<p>Wenn ihr was findet, danke ich euch SEHR!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/163050/immer-mehr-private-bytes</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 12:31:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/163050.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Oct 2006 15:05:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 15:05:55 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Könnt ihr mir verraten, warum mein Programm immer mehr private bytes belegt?<br />
Zu Beginn sind es 644K, nach etwa 8 Stunden Laufzeit sind es 3MB geworden.</p>
<p>Dabei lösche ich doch alle 10 Sekunden mit UpdateOld() alle Arrays, vectoren...Ich verstehe es nicht! Vielleicht findet ihr da was?</p>
<pre><code class="language-cpp">#ifndef INCLUDED_SLOWBOB
#define INCLUDED_SLOWBOB

//// &lt; I N C L U D E S &gt; /////////////////////////
#include &lt;windows.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;
#include &quot;soci.h&quot;
#include &quot;soci-mysql.h&quot;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
class SlowBob
{
	HWND hWnd;
	HWND edit;
	HWND list;

	LRESULT itemCount;

	std::string windowTitle;

	TCHAR        recvText[128];
	std::string  s;

	std::string kickText;

	short oldJoinedPlayers;
	short joinedPlayers;
	short bannedPlayers;

	struct oldJoinedPlayer
	{
		std::string ip;
		std::string id;
	}; oldJoinedPlayer oldJoinedPlayer[64];

	struct joinedPlayer
	{
		std::string ip;
		std::string id;
	}; joinedPlayer joinedPlayer[64];

	struct bannedPlayer
	{
		std::string ip;
	}; bannedPlayer bannedPlayer[1000];

	std::ifstream  config;
	std::ifstream  banned;
	std::ifstream  mySql;
	std::string    row;

	bool mode;

	std::vector&lt;std::string&gt; configRow;
	std::vector&lt;std::string&gt; bannedRow;
	std::vector&lt;std::string&gt; mySqlRow;

	std::vector&lt;std::string&gt; kickList;

	float interval;
	float current;
	float elapsed;
	float old;
public:
	SlowBob();
	~SlowBob();

	void Tick();
	void Check();
	void Kick();
	void UpdateOld();

	void getJoinedPlayers();
	void getJoinedPlayerIds();
	void getJoinedPlayerIps();
	void getBannedPlayerIpsTXT();
	void getBannedPlayerIpsSQL();

	void sendText(std::string);
	void kickPlayer(std::string);
};

#endif // INCLUDED_SLOWBOB
</code></pre>
<pre><code class="language-cpp">//// &lt; I N C L U D E S &gt; /////////////////////////
#include &quot;SlowBob.h&quot;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
SlowBob::SlowBob()
{
	config.open(&quot;config.txt&quot;);

	// We need this file
	if(!config.is_open())
	{
		MessageBox(NULL, &quot;Open config.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	// Read out all rows
	while(std::getline(config, row))
	{
		configRow.push_back(row);
	}

	// Textfile mode
	if(configRow[1] == &quot;TXT&quot;)
		mode = 0;
	// SQL database mode
	else
		mode = 1;

	windowTitle   = configRow[0];
	interval      = (float)atoi(configRow[2].c_str());
	if(interval &lt; 1.0)
		interval = 1.0f;
	kickText      = configRow[3];

	// Current last row + 1
	itemCount = 99;

	// Get handles of vcded- window, its listbox and edit- field
	hWnd = FindWindow(0, windowTitle.c_str());

	if(hWnd == NULL)
	{
		MessageBox(NULL, &quot;Window not found. Check server name!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	edit = FindWindowEx(hWnd, 0, &quot;Edit&quot;, 0);
	list = FindWindowEx(hWnd, 0, &quot;ListBox&quot;, 0);

	// Set to 0
	elapsed  = 0.0f;
	old      = 0.0f;

	bannedPlayers = 0;

	memset(&amp;oldJoinedPlayer, 0, sizeof(oldJoinedPlayer));
	memset(&amp;joinedPlayer, 0, sizeof(joinedPlayer));
	memset(&amp;bannedPlayer, 0, sizeof(bannedPlayer));
	memset(&amp;recvText, 0, sizeof(recvText));

	// Just spam a little so that we can begin with 99 rows, not very elegant
	for(int a = 0; a &lt; 50; a++)
		sendText(&quot;fillup&quot;);
}

SlowBob::~SlowBob()
{
	config.close();
}

void SlowBob::Tick()
{
	// Calculate elapsed time
	current  = timeGetTime() / 1000.0f;
	elapsed  += (current - old);
	old      = timeGetTime() / 1000.0f;

	if(elapsed &gt;= interval)
	{
		getJoinedPlayers();
		getJoinedPlayerIds();
		getJoinedPlayerIps();

		if(mode)
			getBannedPlayerIpsSQL();
		else
			getBannedPlayerIpsTXT();

		Check();

		if(kickList.size() &gt; 0)
			Kick();

		UpdateOld();

		elapsed = 0.0f;
	}

	Sleep(1);
}

void SlowBob::Check()
{
	// For every joined player
	for(int a = 0; a &lt; joinedPlayers; a++)
	{
		// For every banned player
		for(int b = 0; b &lt; bannedPlayers; b++)
		{
			// If joined player and banned player IP is the same
			if(!strcmp(joinedPlayer[a].ip.c_str(), bannedPlayer[b].ip.c_str()))
			{
				//if(b == (bannedPlayers - 1))
					// Add him to kick list
					kickList.push_back(joinedPlayer[a].id);
			}
			//else
				//b = bannedPlayers - 1;
		}
	}
}

void SlowBob::Kick()
{
	sendText(&quot;say \&quot;{SlowBob} &quot; + kickText + &quot;\&quot;&quot;);
	Sleep(1000);

	// For every player in kick- list
	for(unsigned int a = 0; a &lt; kickList.size(); a++) 
		kickPlayer(kickList[a]);

	kickList.clear();
}

void SlowBob::UpdateOld()
{
	memset(&amp;oldJoinedPlayer, 0, sizeof(oldJoinedPlayer));

	// Save checked players for the next rounds to spare playerip commands
	for(int a = 0; a &lt; 64; a++)
	{
		oldJoinedPlayer[a].ip = joinedPlayer[a].ip;
		oldJoinedPlayer[a].id = joinedPlayer[a].id;
	}

	oldJoinedPlayers = joinedPlayers;

	memset(&amp;joinedPlayer, 0, sizeof(joinedPlayer));
	memset(&amp;bannedPlayer, 0, sizeof(bannedPlayer));
	memset(&amp;recvText, 0, sizeof(recvText));

	configRow.clear();
	bannedRow.clear();
	mySqlRow.clear();
}

void SlowBob::getJoinedPlayers()
{
	sendText(&quot;list&quot;);
	Sleep(1000);

	// Receive last row
	SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
	s = recvText;

	// If &quot;Total players:&quot; not found, jump a row higher and read out again
	while(s.find(&quot;Total players:&quot;) == std::string::npos)
	{
		itemCount--;
		SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
		s = recvText;
	}

	// Save total players
	joinedPlayers = atoi((s.substr(15).c_str()));
}

void SlowBob::getJoinedPlayerIds()
{
	// For every joined player
	for(int a = 2, b = joinedPlayers - 1; a &lt;= (joinedPlayers + 1), b &gt;= 0; a++, b--)
	{
		// Get the row one above &quot;Total players:&quot; to begin readin' out player ID's
		SendMessage(list, LB_GETTEXT, itemCount - a, (LPARAM)recvText);
		s = recvText;

		// If &quot;ping&quot; is not found, it cannot be the right row
		while(s.find(&quot;ping&quot;) == std::string::npos)
		{
			itemCount--;
			SendMessage(list, LB_GETTEXT, itemCount - a, (LPARAM)recvText);
			s = recvText;
		}

		size_t pos = s.find(&quot;]&quot;);

		// Cut out the string from &quot;[&quot; + 1 till &quot;]&quot; - 1
		joinedPlayer[b].id  = s.substr(1, pos - 1);

		itemCount = 99;
	}
}

void SlowBob::getJoinedPlayerIps()
{
	// For every joined player
	for(int a = 0; a &lt; joinedPlayers; a++)
	{
		// For every old joined player
		for(int b = 0; b &lt; oldJoinedPlayers; b++)
		{
			// If the player got checked already
			if(joinedPlayer[a].id == oldJoinedPlayer[b].id)
				joinedPlayer[a].ip = oldJoinedPlayer[b].ip;
		}

		if(strlen(joinedPlayer[a].ip.c_str()) &lt; 7)
		{
			sendText(&quot;playerip &quot; + joinedPlayer[a].id);
			Sleep(500);

		    SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
			s = recvText;

			// If all these strings are not found, we are definitely in the wrong row
			while(s.find(&quot;player #&quot;) == std::string::npos 
			   &amp;&amp; s.find(&quot;]error:&quot;) == std::string::npos 
			   &amp;&amp; s.find(&quot;playerip failed&quot;) == std::string::npos)
			{
				itemCount--;
				SendMessage(list, LB_GETTEXT, itemCount - 1, (LPARAM)recvText);
				s = recvText;
			}

			if(s.find(&quot;playerip failed&quot;) != std::string::npos)
			{
				sendText(&quot;say \&quot;{SlowBob} Could not seek IP. Penalty: Kick\&quot;&quot;);
				Sleep(2000);
				kickPlayer(joinedPlayer[a].id);
			}
			// Finally, if we got the right row, save the god damned IP
			else if(s.find(&quot;player #&quot;) != std::string::npos)
				joinedPlayer[a].ip  = s.substr(s.find(&quot;:&quot;) + 2);
		}

		itemCount = 99;
	}
}

void SlowBob::getBannedPlayerIpsTXT()
{
	banned.open(&quot;banned.txt&quot;);

	if(!banned.is_open())
	{
		MessageBox(NULL, &quot;Open banned.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	while(std::getline(banned, row))
	{
		bannedRow.push_back(row);
		bannedPlayers++;
	}

	for(unsigned int a = 0; a &lt; bannedRow.size(); a++) 
		bannedPlayer[a].ip = bannedRow[a];

	banned.close();
}

void SlowBob::getBannedPlayerIpsSQL()
{
	mySql.open(&quot;sql.txt&quot;);

	if(!mySql.is_open())
	{
		MessageBox(NULL, &quot;Open sql.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
	}

	// SOCI::BackEndFactory const &amp;backEnd = SOCI::mysql;
	// SOCI::Session session(backEnd, &quot;service=mydb user=john password=secret&quot;);

	// session &lt;&lt; &quot;Select&quot;;

	mySql.close();
}

void SlowBob::sendText(std::string text)
{
	// Sends a string to the edit- field
	SendMessage(edit, WM_SETTEXT, 0, (LPARAM)text.c_str());
	// Don' t forget to simulate a keystroke
	SendMessage(edit, WM_KEYDOWN, VK_RETURN, 0);
}

void SlowBob::kickPlayer(std::string id)
{
	sendText(&quot;kick &quot; + id);
	Sleep(200);
}
</code></pre>
<p>Wenn ihr was findet, danke ich euch SEHR!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161081</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161081</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Wed, 25 Oct 2006 15:05:55 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 17:07:37 GMT]]></title><description><![CDATA[<p>lies doch bitte mal die FAQ, da steht dass (mit hoer warscheinlichkeit)<br />
NIEMAND ein ganzes Programm Listing durchliest...<br />
auserdem:<br />
ich glaube mit nem debugger (und nem profiler (nicht umbedingt) ) könntest du dem problem auf die sprünge kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161179</guid><dc:creator><![CDATA[branleb]]></dc:creator><pubDate>Wed, 25 Oct 2006 17:07:37 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 17:36:53 GMT]]></title><description><![CDATA[<p>Ich bin mehr oder weniger Anfänger. Leider komme ich einfach nicht dahinter.</p>
<p>Vielleicht schaut sich jemand die Klassendefinition an.</p>
<p>Kann es an std::vector liegen? Jedoch mache ich alle 10 Sekunden .clear().</p>
<p>An was könnte es noch liegen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161203</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Wed, 25 Oct 2006 17:36:53 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 17:49:22 GMT]]></title><description><![CDATA[<p>Wenn du noch so ein anfänger bist, das du den debugger nicht mal<br />
benutzten kannst/ willst?? dann wür dich auch net WinApi machen...</p>
<p>versuchs doch einfach mit nem Debugger..welche IDE/Compiler hastu denn ???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161213</guid><dc:creator><![CDATA[branleb]]></dc:creator><pubDate>Wed, 25 Oct 2006 17:49:22 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 18:04:26 GMT]]></title><description><![CDATA[<p>Auf die schnelle sehe ich nichts in Deinem geposteten Code der Leaks verursachen könnte (überflogen). Es wird viel kopiert in der Klasse, eventuell versursacht der Client der Klasse die Leaks.</p>
<p>Aber generell solltest Du Dich mal mit der STL , referenzen und C++ ein wenig beschäftigen. Es gäbe einige dinge zu verbessern. Die FAQ und die Artikel (Forenübersicht, ziemlich weit unten) helfen Dir ideal für einen schnellen einstieg.</p>
<p>Memoryleaks lassen sich trotz Debugger nicht immer einfach finden und können auch für &quot;nicht anfänger&quot; problematisch zu finden sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161235</guid><dc:creator><![CDATA[Knuddlbaer]]></dc:creator><pubDate>Wed, 25 Oct 2006 18:04:26 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 22:02:32 GMT]]></title><description><![CDATA[<p>Komisch ich finde es einfach nicht heraus. Der Debugger verwirrt mich. Leider stehe ich unter Zeitdruck (Ich möchte VC 1 retten :|)</p>
<p>Habe versucht, den Code zu optimieren.</p>
<pre><code class="language-cpp">#ifndef INCLUDED_SLOWBOB
#define INCLUDED_SLOWBOB

//// &lt; I N C L U D E S &gt; /////////////////////////
#include &lt;windows.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
class SlowBob
{
	std::string windowTitle;

	HWND hWnd;
	HWND edit;
	HWND list;

	LRESULT currentRow;

	TCHAR        recvText[128];
	std::string  s;

	std::string kickText;

	short oldJoinedPlayers;
	short joinedPlayers;
	short bannedPlayers;

	struct oldJoinedPlayer
	{
		std::string ip;
		std::string id;
	}; oldJoinedPlayer oldJoinedPlayer[64];

	struct joinedPlayer
	{
		std::string ip;
		std::string id;
	}; joinedPlayer joinedPlayer[64];

	struct bannedPlayer
	{
		std::string ip;
	}; bannedPlayer bannedPlayer[1000];

	std::ifstream configFile;
	std::ifstream bannedFile;

	std::vector&lt;std::string&gt; configRow;
	std::vector&lt;std::string&gt; bannedRow;

	std::string row;

	std::vector&lt;std::string&gt; kickList;

	float interval;
	float current;
	float elapsed;
	float old;
public:
	SlowBob();
	~SlowBob();

	void Tick();
	void Check();
	void Kick();
	void SaveOld();
	void Clear();

	void getJoinedPlayers();
	void getJoinedPlayerIds();
	void getJoinedPlayerIps();
	void getBannedPlayerIps();

	void sendText(std::string);
	void kickPlayer(std::string);
};

#endif // INCLUDED_SLOWBOB
</code></pre>
<pre><code class="language-cpp">//// &lt; I N C L U D E S &gt; /////////////////////////
#include &quot;SlowBob.h&quot;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
SlowBob::SlowBob()
{
	configFile.open(&quot;config.txt&quot;);
	bannedFile.open(&quot;banned.txt&quot;);

	// We need these files
	if(!configFile.is_open())
	{
		MessageBox(NULL, &quot;Open config.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
		return;
	}
	if(!bannedFile.is_open())
	{
		MessageBox(NULL, &quot;Open banned.txt failed!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
		return;
	}

	// Read out all rows
	while(std::getline(configFile, row))
		configRow.push_back(row);

	windowTitle   = configRow[0];
	interval      = (float)atoi(configRow[1].c_str());
	if(interval &lt; 1.0)
		interval = 1.0f;
	kickText      = configRow[2];

	// Get handles of vcded- window, its listbox and edit- field
	if(!(hWnd = FindWindow(0, windowTitle.c_str())))
	{
		MessageBox(NULL, &quot;Window not found. Check server name!&quot;, &quot;Error&quot;, MB_OK);
		PostQuitMessage(0);
		return;
	}
	edit = FindWindowEx(hWnd, 0, &quot;Edit&quot;, 0);
	list = FindWindowEx(hWnd, 0, &quot;ListBox&quot;, 0);

	currentRow = 98;

    Clear();

	getBannedPlayerIps();

	// Just spam a little so that we can begin with 99 rows, not very elegant
	for(int a = 0; a &lt; 50; a++)
		sendText(&quot;fillup&quot;);
}

SlowBob::~SlowBob()
{
	configFile.close();
	bannedFile.close();
}

void SlowBob::Tick()
{
	current  = timeGetTime() / 1000.0f;
	elapsed  += (current - old);
	old      = timeGetTime() / 1000.0f;

	if(elapsed &gt;= interval)
	{
		getJoinedPlayers();
		getJoinedPlayerIds();
		getJoinedPlayerIps();

		Check();

		if(kickList.size() &gt; 0)
			Kick();

		SaveOld();
		Clear();

		elapsed = 0.0f;
	}

	Sleep(1);
}

void SlowBob::Check()
{
	// For every joined player
	for(int a = 0; a &lt; joinedPlayers; a++)
	{
		// For every banned player
		for(int b = 0; b &lt; bannedPlayers; b++)
		{
			// If joined player and banned player IP is the same
			if(!strcmp(joinedPlayer[a].ip.c_str(), bannedPlayer[b].ip.c_str()))
			{
				//if(b == (bannedPlayers - 1))
					// Add him to kick list
					kickList.push_back(joinedPlayer[a].id);
			}
			//else
				//b = bannedPlayers - 1;
		}
	}
}

void SlowBob::Kick()
{
	sendText(&quot;say \&quot;{SlowBob} &quot; + kickText + &quot;\&quot;&quot;);
	Sleep(1000);

	// For every player in kick- list
	for(unsigned int a = 0; a &lt; kickList.size(); a++) 
		kickPlayer(kickList[a]);

	kickList.clear();
}

void SlowBob::SaveOld()
{
	memset(&amp;oldJoinedPlayer, 0, sizeof(oldJoinedPlayer));

	// Save checked players for the next rounds to spare playerip commands
	for(int a = 0; a &lt; 64; a++)
	{
		oldJoinedPlayer[a].ip = joinedPlayer[a].ip;
		oldJoinedPlayer[a].id = joinedPlayer[a].id;
	}

	oldJoinedPlayers = joinedPlayers;
}

void SlowBob::Clear()
{
	// Be sure to have a clean memory!
	memset(&amp;recvText, 0, sizeof(recvText));
	memset(&amp;joinedPlayer, 0, sizeof(joinedPlayer));
	memset(&amp;row, 0, sizeof(row));

	configRow.clear();
	bannedRow.clear();
	kickList.clear();
}

void SlowBob::getJoinedPlayers()
{
	sendText(&quot;list&quot;);
	Sleep(1000);

	// Receive last row
	SendMessage(list, LB_GETTEXT, currentRow, (LPARAM)recvText);
	s = recvText;

	// If &quot;Total players:&quot; not found, jump a row higher and read out again
	while(s.find(&quot;Total players: &quot;) == std::string::npos)
	{
		currentRow--;
		SendMessage(list, LB_GETTEXT, currentRow, (LPARAM)recvText);
		s = recvText;
	}

	// Save total players
	joinedPlayers = atoi((s.substr(15).c_str()));

	// Clear out to be on the save way
	memset(&amp;recvText, 0, sizeof(recvText));

	// Set back to last row
	currentRow = 98;
}

void SlowBob::getJoinedPlayerIds()
{
	// For every joined player
	for(int a = 1, b = joinedPlayers - 1; a &lt;= joinedPlayers, b &gt;= 0; a++, b--)
	{
		// Get the row one above &quot;Total players:&quot; to begin readin' out player ID's
		SendMessage(list, LB_GETTEXT, currentRow - a, (LPARAM)recvText);
		s = recvText;

		// If &quot;ping&quot; is not found, it cannot be the right row
		while(s.find(&quot;ping&quot;) == std::string::npos)
		{
			currentRow--;
			SendMessage(list, LB_GETTEXT, currentRow - a, (LPARAM)recvText);
			s = recvText;
		}

		size_t pos = s.find(&quot;]&quot;);

		// Cut out the string from &quot;[&quot; + 1 till &quot;]&quot; - 1
		joinedPlayer[b].id  = s.substr(1, pos - 1);

		currentRow = 98;

		// Clear out to be on the save way
		memset(&amp;recvText, 0, sizeof(recvText));
	}
}

void SlowBob::getJoinedPlayerIps()
{
	// For every joined player
	for(int a = 0; a &lt; joinedPlayers; a++)
	{
		// For every old joined player
		for(int b = 0; b &lt; oldJoinedPlayers; b++)
		{
			// If the player got checked already
			if(joinedPlayer[a].id == oldJoinedPlayer[b].id)
				joinedPlayer[a].ip = oldJoinedPlayer[b].ip;
		}

		if(strlen(joinedPlayer[a].ip.c_str()) &lt; 7)
		{
			sendText(&quot;playerip &quot; + joinedPlayer[a].id);
			Sleep(500);

		    SendMessage(list, LB_GETTEXT, currentRow, (LPARAM)recvText);
			s = recvText;

			// If all these strings are not found, we are definitely in the wrong row
			while(s.find(&quot;player #&quot;) == std::string::npos 
			   &amp;&amp; s.find(&quot;]error:&quot;) == std::string::npos 
			   &amp;&amp; s.find(&quot;playerip failed&quot;) == std::string::npos)
			{
				currentRow--;
				SendMessage(list, LB_GETTEXT, currentRow, (LPARAM)recvText);
				s = recvText;
			}

			if(s.find(&quot;playerip failed&quot;) != std::string::npos)
			{
				sendText(&quot;say \&quot;{SlowBob} Could not seek IP. Penalty: Kick\&quot;&quot;);
				Sleep(2000);
				kickPlayer(joinedPlayer[a].id);
			}
			// Finally, if we got the right row, save the god damned IP
			else if(s.find(&quot;player #&quot;) != std::string::npos)
				joinedPlayer[a].ip  = s.substr(s.find(&quot;:&quot;) + 2);
		}

		currentRow = 98;
	}
}

void SlowBob::getBannedPlayerIps()
{
	bannedPlayers = 0;

	while(std::getline(bannedFile, row))
	{
		bannedRow.push_back(row);
		bannedPlayers++;
	}

	for(unsigned int a = 0; a &lt; bannedRow.size(); a++) 
		bannedPlayer[a].ip = bannedRow[a];
}

void SlowBob::sendText(std::string text)
{
	// Sends a string to the edit- field
	SendMessage(edit, WM_SETTEXT, 0, (LPARAM)text.c_str());
	// Don' t forget to simulate a keystroke
	SendMessage(edit, WM_KEYDOWN, VK_RETURN, 0);
}

void SlowBob::kickPlayer(std::string id)
{
	sendText(&quot;kick &quot; + id);
	Sleep(200);
}
</code></pre>
<p>Ich wäre euch wirklich sehr dankbar. Ich hoffe einfach auf jemanden, der sich langweilt oder mir einfach helfen möchte ^^</p>
<p>(Bin auch für Verbesserungsvorschläge dankbar!)</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161522</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Wed, 25 Oct 2006 22:02:32 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 22:32:47 GMT]]></title><description><![CDATA[<p>Hi,<br />
ohne mir das näher angeschaut zu haben.<br />
Das muss nicht zwangsläufig nen Memory Leak sein.<br />
Deine vectoren werden durch nen clear nicht kleiner.<br />
Lass dir nach den 8 Stunden mal mit vector::capacity ausgeben wieviel Platz deine vectoren sich bis dahin schon reserviert haben.(oder lass es regelmässig in nen Logfile schreiben).</p>
<p>Gruß Spacelord</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161529</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161529</guid><dc:creator><![CDATA[Spacelord]]></dc:creator><pubDate>Wed, 25 Oct 2006 22:32:47 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 22:54:25 GMT]]></title><description><![CDATA[<p>Oder lass mal einfach laufen und guck was passiert. Ob sich der Wert irgendwo einpendelt nach ein paar Tagen. 2.4MB in 8 Stunden sind eigentlich nix.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161532</guid><dc:creator><![CDATA[Plotzenhotz]]></dc:creator><pubDate>Wed, 25 Oct 2006 22:54:25 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Wed, 25 Oct 2006 23:58:29 GMT]]></title><description><![CDATA[<p>Mhh ok mal sehn.</p>
<p>Dachte, durch .clear() wird die Liste gelöscht? Ich möchte ja nicht immer mehr hinzupushen, wäre ja kein Wunder, wenn dann der speicher hochgeht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161537</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161537</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Wed, 25 Oct 2006 23:58:29 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 00:52:12 GMT]]></title><description><![CDATA[<p>@Hello: ja, durch .clear() wird &quot;die Liste gelöscht&quot;, das stimmt schon. Danach ist der vector/die list/... &quot;leer&quot;. Das heisst aber nicht notwendigerweise dass dort Speicher freigegeben wird. Wenn du 1 Million chars in einen vector tust, dann wird der &gt;= 1MB Speicher brauchen. Wenn du den vector dann mit .clear() leer machst wird dieser Speicher nicht zurückgegeben. Wenn du dann allerdings nochmal bis zu 1 Million neue chars reintust wird der &quot;alte Speicher&quot; wiederverwendet - der Speicherverbrauch wächst also nicht unendlich an sondern stabilisiert sich wenn das max. an Elementen erreicht ist welches jemals *gleichzeitig* in diesem vector steckt.</p>
<p>Wenn du einen std::vector&lt;T&gt; wirklich leer machen willst, so dass auch der Speicher freigegeben wird, dann kannst du das normalerweise recht einfach so machen:</p>
<pre><code class="language-cpp">void foo()
{
    //...
    {
        std::vector&lt;T&gt; tmp(0);
        m_vector.swap(tmp);
    } // hier wird der Speicher zurückgegeben
    //...
}
</code></pre>
<p>Ich weiss nicht ob der Standard explizit garantiert dass dabei der Speicher freigegeben wird, aber ich weiss ganz sicher dass es in einigen Implementierungen funktioniert, und ich vermute in allen. Und diverse Garantien die der Standard vorschreibt (vector::swap muss in O(1) laufen, gleiche allocator vorausgesetzt) sprechen dafür dass es überall so ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161541</guid><dc:creator><![CDATA[Plotzenhotz]]></dc:creator><pubDate>Thu, 26 Oct 2006 00:52:12 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 14:19:40 GMT]]></title><description><![CDATA[<p>Dankesehr!</p>
<p>Habe nur 3 std::vector im Programm und die werden immer wieder .clear() habs auch überprüft da is nix falsch.</p>
<p>Schaut euch doch mal bitte meine Klassendefinition an.</p>
<p>Was könnte noch so viel Speicher fressen?</p>
<p>Sind heute knapp 4MB geworden nach nur 6 Stunden. Sehr seltsam</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161949</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161949</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Thu, 26 Oct 2006 14:19:40 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 14:53:31 GMT]]></title><description><![CDATA[<p>Solange Du nicht liest, was die Leute hier antworten, wirst Du Dein Problem wohl auch nicht gelöst bekommen.</p>
<p>.... aber für wen schreibe ich das hier eigentlich ? ... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161981</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Thu, 26 Oct 2006 14:53:31 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 15:17:10 GMT]]></title><description><![CDATA[<p>Ich habe doch gelesen!</p>
<p>Es kann eigentlich nur bei std::vector zu viel Speicher verbraucht werden, oder? Wo sonst? Die nicht-arrays werden überschrieben... Und alle 3 vectoren cleare ich alle 10 Sekunden.</p>
<p>Ich verstehs einfach ned........</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162002</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162002</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Thu, 26 Oct 2006 15:17:10 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 15:23:24 GMT]]></title><description><![CDATA[<p>Du kannst deinen vector auch jede Sekunde clearen und er belegt trotzdem noch den gleichen Speicher!!<br />
Nach oben hin verändert nen vector seine Größe dynamisch,nach unten hin nicht.Da musst du schon mit nem swap nachhelfen wie es dir Plotzenhotz schon gezeigt hat.<br />
Was sagt dir capacity wenn dein Programm 8 Stunden gelaufen ist?<br />
Lass das doch einfach in eine Datei schreiben.</p>
<p>Gruß Spacelord</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162008</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162008</guid><dc:creator><![CDATA[Spacelord]]></dc:creator><pubDate>Thu, 26 Oct 2006 15:23:24 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 15:34:53 GMT]]></title><description><![CDATA[<p>Ja, aber, es ist doch so:</p>
<p>Zwei von 3 vectoren werden nur im Konstruktor aufgefüllt und danach nicht mehr &quot;gepusht&quot;. (configRow und bannedRow, das sind die Zeilen der Textdateien)</p>
<p>kickList wird bei Bedarf mit bis zu maximal 64 Elementen gepusht. Danach wird .clear() aufgerufen. Und nach 10 Sekunden werden wieder maximal 64 Elemente gepusht.</p>
<p>Was also reserviert sich den ganzen Speicher...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162017</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Thu, 26 Oct 2006 15:34:53 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 15:44:48 GMT]]></title><description><![CDATA[<p>Nun, es wird ja auch jemanden geben, der Deine Klasse einsetzt. Hast Du diese Umgebung abgesucht ?</p>
<p>@Plotzenhotz registrier Dich doch mal bitte, dann weiss man wenigstens das immer der gleiche schreibt =o)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162026</guid><dc:creator><![CDATA[Knuddlbaer]]></dc:creator><pubDate>Thu, 26 Oct 2006 15:44:48 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 16:09:46 GMT]]></title><description><![CDATA[<p>Hello!</p>
<p>Nein, bis jetzt habe nur ich das Programm so lange am laufen.<br />
Wird auf nem anderen PC aber ned anders sein, denke ich.</p>
<p>Leider muss ich des öfteren die Anwendung neu starten, wenn ich IP's zur Textdatei adde. Aber ich werde versuchen, das Teil mal wirklich lange laufen zu lassen. Wiegesagt, an den vectoren liegt es nicht. kickList fasst maximal 64 Player-ID's.</p>
<p>Ach, noch eine kleine Frage: Wie lange läuft Windows XP Prof. ohne Absturz? Hab mal gehört, das soll Begrenzt sein. Was für'n Beschiss!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162050</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162050</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Thu, 26 Oct 2006 16:09:46 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 16:11:44 GMT]]></title><description><![CDATA[<p>Der von Dir gezeigte Quellcode hat keinen gültigen Einstiegspunkt. Also wird es noch etwas drum herum geben was die Klasse benutzt.</p>
<p>Generell kann man nur jemanden helfen, der auch hilfe haben will.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162053</guid><dc:creator><![CDATA[Knuddlbaer]]></dc:creator><pubDate>Thu, 26 Oct 2006 16:11:44 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Thu, 26 Oct 2006 16:35:54 GMT]]></title><description><![CDATA[<p>Sorry!</p>
<p>Aber da passiert nichts besonderes.</p>
<pre><code class="language-cpp">//// &lt; M A I N  F U N C T I O N &gt; ////////////////
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
	Window&amp; window = Window::getInstance();
	window.Init(hInstance);
	window.Create();

	SlowBob slowBob;

	MSG msg = {0};

	while(msg.message != WM_QUIT)
	{
	    if(PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE)) 
		{
			TranslateMessage(&amp;msg);
			DispatchMessage(&amp;msg);
        }
		else
			slowBob.Tick();
    }

	window.Destroy();

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1162070</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162070</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Thu, 26 Oct 2006 16:35:54 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Fri, 27 Oct 2006 13:31:13 GMT]]></title><description><![CDATA[<p>kann es sein das dein ListCtrl den Speicher 'frist' , weil nach 6 oder 8 Stunden tausende Zeilen drin stehen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162514</guid><dc:creator><![CDATA[idefix]]></dc:creator><pubDate>Fri, 27 Oct 2006 13:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Fri, 27 Oct 2006 13:58:47 GMT]]></title><description><![CDATA[<p>Wenn ein Programm immer mehr Speicher verbraucht, dann ist es in der Regel eine gute Idee, sich mal anzuschauen, was im Speicher nach einer Weile so drinsteht.<br />
Mach einfach ein Memory Dump mit einem Programm wie T-Search.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162547</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162547</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Fri, 27 Oct 2006 13:58:47 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Fri, 27 Oct 2006 17:22:07 GMT]]></title><description><![CDATA[<p>Damit hab ich nix am Hut. Ich werd's dennoch probieren.</p>
<p>Wiegesagt, ich habe nur 3 std::vector's. Es kann ja nur an denen liegen, alles andere wird überschrieben!</p>
<p>configRow für alle Zeilen in config.txt<br />
bannedRow für alle Zeilen in banned.txt</p>
<p>ABER: Diese vectoren werden nur im Konstruktor aufgefüllt, danach passiert mit denen KEIN push_back mehr.</p>
<p>Der letzte vector ist kickList, diese wird bis zu maximal 64x gepusht, und alle 10 Sekunden werden die Elemente wieder entfernt.</p>
<p>Unverständlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162705</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162705</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Fri, 27 Oct 2006 17:22:07 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Fri, 27 Oct 2006 17:31:04 GMT]]></title><description><![CDATA[<p>Wenn es nur an den Vectoren liegen kann, weißt Du doch schon die Lösung, verstehe dann das nachfragen nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162715</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162715</guid><dc:creator><![CDATA[Knuddlbaer]]></dc:creator><pubDate>Fri, 27 Oct 2006 17:31:04 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Fri, 27 Oct 2006 17:54:46 GMT]]></title><description><![CDATA[<p>Ich vermute es stark. Alle anderen Klassenmember werden doch nur überschrieben?...</p>
<p>Deshalb bin ich ratlos.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162744</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Fri, 27 Oct 2006 17:54:46 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Fri, 27 Oct 2006 17:56:18 GMT]]></title><description><![CDATA[<p>Heut waren es wieder über 5MB nach einigen Stunden.</p>
<p>Was kann noch so viel Speicher fressen außer die vectoren, die es ja codetechnisch gar nicht sein können? Schaut mal bei Tick(), sobald auch nur ein Element in kickList ist, wird Kick() aufgerufen, wo ohne Bedingung kickList.clear() aufgerufen wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162747</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162747</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Fri, 27 Oct 2006 17:56:18 GMT</pubDate></item><item><title><![CDATA[Reply to Immer mehr private bytes :( on Sun, 29 Oct 2006 01:44:21 GMT]]></title><description><![CDATA[<p>Hey!</p>
<p>Ich frage mal so: Welches dieser Klassenmitglieder könnte so viel Speicher fressen? Es sind doch nur die vectoren, oder was kann sonst einige Megabyte verschlingen?</p>
<pre><code class="language-cpp">#ifndef INCLUDED_SLOWBOB
#define INCLUDED_SLOWBOB

//// &lt; I N C L U D E S &gt; /////////////////////////
#include &lt;windows.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;

//// &lt; C L A S S  SlowBob &gt; //////////////////////
class SlowBob
{
	std::string windowTitle;

	HWND hWnd;
	HWND edit;
	HWND list;

	LRESULT currentRow;

	TCHAR        recvText[128];
	std::string  s;

	std::string kickText;

	short oldJoinedPlayers;
	short joinedPlayers;
	short bannedPlayers;

	struct oldJoinedPlayer
	{
		std::string ip;
		std::string id;
	}; oldJoinedPlayer oldJoinedPlayer[64];

	struct joinedPlayer
	{
		std::string ip;
		std::string id;
	}; joinedPlayer joinedPlayer[64];

	std::ifstream configFile;
	std::ifstream bannedFile;

	std::vector&lt;std::string&gt; configRow;
	std::vector&lt;std::string&gt; bannedIp;

	std::string row;

	std::vector&lt;std::string&gt; kickList;

	float interval;
	float current;
	float elapsed;
	float old;
public:
	SlowBob();
	~SlowBob();

	void Tick();
	void Check();
	void Kick();
	void SaveOld();

	void getJoinedPlayers();
	void getJoinedPlayerIds();
	void getJoinedPlayerIps();

	void sendText(std::string);
	void kickPlayer(std::string);
};

#endif // INCLUDED_SLOWBOB
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1163503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1163503</guid><dc:creator><![CDATA[Hello]]></dc:creator><pubDate>Sun, 29 Oct 2006 01:44:21 GMT</pubDate></item></channel></rss>