24.01.2010, 19:35
Erm...
As you can see i have mysql_free_result() at the end, but it doesn't free RAM memory usage. I started this ConfigRace() function 500 times and it increased my samp-server.exe by ~20MB. Is mysql_free_result() bugged in this plugin like in another two?
P.S. I have mysql_get_field...
pawn Code:
stock ConfigRace()
{
new CpCfgStr[4][56];
sInfo[MaxRaces] = -1;
for(new cfg = 0; cfg < 50; cfg++)
{
format(query,sizeof(query),"SELECT * FROM races WHERE raceid = %d",cfg);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
mysql_fetch_row(line);
mysql_get_field("name",sql);
format(rInfo[cfg][Name],128,"%s",sql);
mysql_get_field("minx",sql);
rInfo[cfg][minX] = floatstr(sql);
mysql_get_field("maxx",sql);
rInfo[cfg][maxX] = floatstr(sql);
mysql_get_field("miny",sql);
rInfo[cfg][minY] = floatstr(sql);
mysql_get_field("maxy",sql);
rInfo[cfg][maxY] = floatstr(sql);
mysql_get_field("Z", sql);
rInfo[cfg][spawnZ] = floatstr(sql);
for(new ccfg = 1; ccfg < 26; ccfg++)
{
format(CpCfgStr[0],56,"cp%d_x",ccfg);
format(CpCfgStr[1],56,"cp%d_y",ccfg);
format(CpCfgStr[2],56,"cp%d_z",ccfg);
format(CpCfgStr[3],56,"cp%d_param",ccfg);
mysql_get_field(CpCfgStr[0], sql);
rCP[cfg][ccfg][Xr] = floatstr(sql);
mysql_get_field(CpCfgStr[1], sql);
rCP[cfg][ccfg][Yr] = floatstr(sql);
mysql_get_field(CpCfgStr[2], sql);
rCP[cfg][ccfg][Zr] = floatstr(sql);
mysql_get_field(CpCfgStr[3], rCP[cfg][ccfg][option]);
}
sInfo[MaxRaces]++;
}
mysql_free_result();
}
return 1;
}
P.S. I have mysql_get_field...
pawn Code:
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)