SA-MP Forums Archive
Invalid memory access. - 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: Invalid memory access. (/showthread.php?tid=653536)



Invalid memory access. - Dayrion - 06.05.2018

Hi. Do you know what "Run time error 5: "Invalid memory access"" can be due? I'm getting this error randomly. A reconnection from the player seems to do the job until the next occurence.
The concerned code is some data manipulation like:
PHP код:
BulletProof_Vest[playerid][slotid][bvdArmor] = armour;
BulletProof_Vest[playerid][slotid][bvdVestType] = vest_type
Nothing impressive.
The backtrace returned by crashdetect prove it doesn't use that much functions (3 max) until the error.

It happened recently on the same code but out of this function. I made those changements and it seems don't generate anymore run time error for this part.
PHP код:
// BulletProof_Vest[receiverid][new_slotid][bvdArmor] = BulletProof_Vest[playerid][slotselected][bvdArmor];
// BulletProof_Vest[receiverid][new_slotid][bvdVestType] = BulletProof_Vest[playerid][slotselected][bvdVestType];
BulletProof_Vest[receiverid][new_slotid] = BulletProof_Vest[playerid][slotselected]; 



Re: Invalid memory access. - Dayrion - 07.05.2018

UP! I'm stuck because of this problem.


Re: Invalid memory access. - jasperschellekens - 07.05.2018

Are u using multiple functions together which are returning string?
Have you compiled in -d3 mode?


Re: Invalid memory access. - Dayrion - 07.05.2018

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Are u using multiple functions together which are returning string?
Have you compiled in -d3 mode?
Sometimes not at all, sometimes yes. Both result on the same error at the same line as described in the first post. :/
Yes I do. I'm using the russian compiler since Zeex's one gave me a lot of trouble.

Edit: Yeah, that's worse with Zeex's compiler
Код:
[19:56:55] [debug] Run time error 8: "Heap underflow"
[19:56:55] [debug]  Heap pointer (HEA) is 0xFFEFC5F4, heap bottom (HLW) is 0xAFA09C
[19:56:55] [debug] AMX backtrace:
[19:56:56] [debug] Run time error 7: "Stack underflow"
[19:56:56] [debug]  Stack pointer (STK) is 0x1B3983C, stack top (STP) is 0x1B39838
[19:56:56] [debug] AMX backtrace:
[19:56:56] [debug] Run time error 7: "Stack underflow"
[19:56:56] [debug]  Stack pointer (STK) is 0x1B3983C, stack top (STP) is 0x1B39838
[19:56:56] [debug] AMX backtrace:
[19:56:56] [debug] Run time error 5: "Invalid memory access"
[19:56:56] [debug] AMX backtrace:
[19:56:56] [debug] #0 00038f14 in public OnPlayerKeyStateChange (... <3 arguments>) at C:\Users\Utilisateur\Desktop\Server files\pawno\include\YSI\YSI\..\YSI_Coding\..\YSI_Internal\y_cgen.inc:115
[19:56:56] [debug] Run time error 7: "Stack underflow"
[19:56:56] [debug]  Stack pointer (STK) is 0x1B3983C, stack top (STP) is 0x1B39838
[19:56:56] [debug] AMX backtrace:
[19:56:56] [debug] Run time error 7: "Stack underflow"
[19:56:56] [debug]  Stack pointer (STK) is 0x1B3983C, stack top (STP) is 0x1B39838



Re: Invalid memory access. - Dayrion - 08.05.2018

UPUPUPUPUPUP.
I don't find any solutions. Most of the threads doesn't have any solutions.


Re: Invalid memory access. - iKarim - 08.05.2018

Are you using any library that's using #emit? That could be the reason for the issues, but it could happen in many different scenarios. Also if you have any backtrace data, please post it too.


Re: Invalid memory access. - Dayrion - 08.05.2018

Quote:
Originally Posted by iKarim
Посмотреть сообщение
Are you using any library that's using #emit? That could be the reason for the issues, but it could happen in many different scenarios. Also if you have any backtrace data, please post it too.
Of course YSI use that with also @emit. I don't have sufficiently knowledge to use #emid nor @emit. There is the backtrace data but it doesn't give any useful informations, unfortunaly. Plus, that run time error happens at some random moments. I mean, sometimes nothing happens and everything works, sometimes it crash.

PHP код:
[13:57:51] [debugRun time error 5"Invalid memory access"
[13:57:51] [debugAMX backtrace:
[
13:57:51] [debug#0 003180b4 in GivePlayerBulletProofVest (playerid=6, Float:armour=0.00000, vest_type=0, sender_id=5, sender_slotid=3) at ..(PATH)/inventory/bulletproof_vest/functions.inc:33
[13:57:51] [debug#1 00306300 in OnPlayerClickGiveButton (playerid=5) at ..(PATH)/textdraws.inc:480
[13:57:51] [debug#2 00300818 in ?? (playerid=5, Text:clickedid=19, ... <1073741821 arguments>) at ..(PATH)/textdraws.inc:130
[13:57:51] [debug#3 00038878 in public OnPlayerClickTextDraw (... <2 arguments>) at (PATH)pawno\include\YSI\YSI\..\YSI_Coding\..\YSI_Internal\y_cgen.inc:115
BulletProof_Vest[playerid][slotid][bvdArmor] = armour// LINE 33
BulletProof_Vest[playerid][slotid][bvdVestType] = vest_type
I added a debug message to see if there is any incorrect values. Nothing bad.
That's the last print before the Run Time Error occurs:
Код:
printf("GivePlayerBulletProofVest -> BPV given to %i // Stats: %f & %i | %i", playerid, armour, slotid, vest_type);
GivePlayerBulletProofVest -> BPV given to 6 // Stats: 0.000000 & 2 | 0
PHP код:
[13:11:36] [debugRun time error 5"Invalid memory access"
[13:11:36] [debugAMX backtrace:
[
13:11:36] [debug#0 0031870c in RemoveBulletProofVest (playerid=6, slotid=0) at (PATH)/bulletproof_vest/functions.inc:86
[13:11:36] [debug#1 002e5ef4 in RemovePlayerAccessory (playerid=6, accessoryid=98, slotid=0) at (PATH)/inventory/core.inc:448
[13:11:36] [debug#2 003188d4 in RemoveEveryBulletProofVest (playerid=6) at (PATH)/bulletproof_vest/functions.inc:100
[13:11:36] [debug#3 002e1a74 in public cmd_remove_vest (playerid=6, ... <1 argument>) at ..(PATH)/bulletproof_vest/core.inc:65
[13:11:36] [debug#4 native CallLocalFunction () from samp-server.exe
[13:11:36] [debug#5 0006afd0 in public FIXES_OnPlayerCommandText (playerid=6, cmdtext[]=@01afb76c "/remove_vest") at (PATH)\pawno\include\izcmd.inc:113
[13:11:36] [debug#6 native CallLocalFunction () from samp-server.exe
[13:11:36] [debug#7 0003176c in public OnPlayerCommandText (playerid=6, cmdtext[]=@01afb738 "/remove_vest") at (PATH)\include\fixes.inc:1966
new partial_reset[E_BULLETPROOF_VEST_DATA];
BulletProof_Vest[playerid][slotid] = partial_reset// LINE 86 
Thanks for you help c:


Re: Invalid memory access. - Dayrion - 09.05.2018

UPUPUPUP. I still believe someone has some good advices which can solve this problem c:


Re: Invalid memory access. - Dayrion - 10.05.2018

Problem still existing