Gandh1
Member
- Joined
- Jan 15, 2008
- Messages
- 16
- Reaction score
- 8
Hi. Sorry for not best english.
Today I got problem with logging into new created project based on TFS 0.4, compiled with mysql++. When I was entering into game as Account Manager, I had memory lack - RAM increased to almost full limit, and I got message on console like "Allocation error".
After checking a code, I found, that the lack is when loading player's conditions field - reading stream / blob from database. Open file databasemysqlpp.cpp, find function
And error is in this line:
This loop is endless, because istream::get() isn't returning 0 on end of stream, but returns EOF macro, that on C++ is -1 (possitive value).
Change this line with this one:
And 'vala - this has worked for me. I'm giving it here, on otland, because it can be helpful for other, and after checking in TFS 0.3.7 I found, that there is no fix for it (I didn't checked newer revs).
Important informations found on: http://www.cplusplus.com/reference/istream/istream/get/
Today I got problem with logging into new created project based on TFS 0.4, compiled with mysql++. When I was entering into game as Account Manager, I had memory lack - RAM increased to almost full limit, and I got message on console like "Allocation error".
After checking a code, I found, that the lack is when loading player's conditions field - reading stream / blob from database. Open file databasemysqlpp.cpp, find function
Code:
const char* MySQLppResult::getDataStream(const std::string& s, uint64_t& size)
And error is in this line:
Code:
for(char c = result->get(); c; c = result->get())
This loop is endless, because istream::get() isn't returning 0 on end of stream, but returns EOF macro, that on C++ is -1 (possitive value).
Change this line with this one:
Code:
for(char c = result->get(); c != EOF; c = result->get())
And 'vala - this has worked for me. I'm giving it here, on otland, because it can be helpful for other, and after checking in TFS 0.3.7 I found, that there is no fix for it (I didn't checked newer revs).
Important informations found on: http://www.cplusplus.com/reference/istream/istream/get/