Page 1 of 1

Big Bug!!!

Posted: 18 May 2013, 05:27
by balder
Big Bug!!!!!!
In c++ client api, why so many new ? many infos returned from the api is new . why not use the value ,not the pointers? Or, why not use stl 's smart pointer?
The SFSRoom::PlayerList and SFSRoom::SpectatorList()

Code: Select all

for (iterator = userManager->GetUserList()->begin(); iterator != userManager->GetUserList()->end(); iterator++)
{
....
}
//File SFSUserManager.cpp  line:178
vector<User *> *SFSUserManager::GetUserList()
{
     vector<User *>* result = new vector<User *>();
......
}
when userManager->GetUserList() called, it will return a new vector<User *> . It loops n times, will leak n times vector<User *>,It's Horrible!!!

Re: Big Bug!!!

Posted: 18 May 2013, 07:45
by balder
the version is the latest version 0.9.5

Re: Big Bug!!!

Posted: 18 May 2013, 22:05
by MBagnati
We are already investigating how simplify the usage of pointers as function parameters, following suggestions incoming from you and from other users, to get two goals:
first to have a general guideline about who is responsible to release memory to avoid leaks;
second to give a more confortable API interface.

Please give us a little time to study the question and fix it into the next API release

Re: Big Bug!!!

Posted: 19 May 2013, 03:30
by balder
why using the pointers. Using the value parameter is a good idea. i think the smartfox client api can make a copy of data from the client,not using the pointers from the client side,then the api side can using the memory pool to speed memory allocation! The speed penalty is very small,or can saved by using the memory pool.

Re: Big Bug!!!

Posted: 11 Jun 2013, 09:08
by MBagnati
Version 0.9.6 contains a review of API interface to improve this issue