SA-MP Forums Archive
What does this debug mean? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What does this debug mean? (/showthread.php?tid=599776)



What does this debug mean? - hoangtn219 - 30.01.2016

[16:08:28] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[16:08:28] [debug] Stack pointer (STK) is 0x298AC14, heap pointer (HEA) is 0x400C888
[16:08:28] [debug] AMX backtrace:
[16:08:28] [debug] #0 00000000 in public cmd_noithat () from vnrpgB.amx
[16:08:28] [debug] #1 native CallLocalFunction () from samp-server.exe
[16:08:28] [debug] #2 00000000 in public OnPlayerCommandText () from vnrpgB.amx
My command:
CMD:noithat(playerid, params[])
{
static
houseid = -1;

if ((houseid = House_Inside(playerid)) != -1 && House_IsOwner(playerid, houseid))
{
new
count = 0,
string[MAX_FURNITURE * 32];

for (new i = 0; i != MAX_FURNITURE; i ++) if (count < MAX_HOUSE_FURNITURE && FurnitureData[i][furnitureExists] && FurnitureData[i][furnitureHouse] == houseid) {
ListedFurniture[playerid][count++] = i;

format(string, sizeof(string), "%s%s (%.2f meters)\n", string, FurnitureData[i][furnitureName], GetPlayerDistanceFromPoint(playerid, FurnitureData[i][furniturePos][0], FurnitureData[i][furniturePos][1], FurnitureData[i][furniturePos][2]));
}
if (count) {
Dialog_Show(playerid, ListedFurniture, DIALOG_STYLE_LIST, "Listed Furniture", string, "Choose", "Cancel");
}
else SendErrorMessage(playerid, "This house doesn't have any furniture spawned.");
}
else SendErrorMessage(playerid, "You are not in range of your house interior.");
return 1;
}


Re: What does this debug mean? - AbyssMorgan - 30.01.2016

at the bottom of the script
PHP код:
#pragma dynamic (64*1024) // 64 KB or more 



Re: What does this debug mean? - Vince - 30.01.2016

Код:
string[MAX_FURNITURE * 32];
I don't know what MAX_FURNITURE is, but let's assume that it's 200. Then this will create a string 6400 cells in size. One cell is 4 bytes, therefore this lone string is 25 KiB in size. The default size of the stack is only 16 KiB. See the problem here?


Re: What does this debug mean? - hoangtn219 - 30.01.2016

Thank you. Vince, AbyssMorgan