SA-MP Forums Archive
Heap underflow issue. - 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: Heap underflow issue. (/showthread.php?tid=541298)



Heap underflow issue. - fonia5 - 11.10.2014

I keep getting spammed with Heap underflow error.


Код:
Run time error 8: "Heap underflow"
[04:23:27] [debug]  Heap pointer (HEA) is 0x18FDB8, heap bottom (HLW) is 0x823098
Not sure what the issue is but i tried messing with
Код:
#pragma dynamic 500000
didn't work.

but i made a pawn.cfg file and addd it to the pawn folder and i got this in the script when i recompiled it.
i think this might be the issue am running crashdetect as well and because it spams me with that error the commands everything stop's working.

Код HTML:
Header size:          23788 bytes
Code size:          2676460 bytes
Data size:          8532120 bytes
Stack/heap size:    2000000 bytes; estimated max. usage=64038 cells (256152 bytes)
Total requirements:13232368 bytes



Re: Heap underflow issue. - Pottus - 11.10.2014

Look at what ****** has to say.

Quote:
Originally Posted by ******
Посмотреть сообщение
This means that the compiler has detected that you are using more stack/heap space than is available. A lot of important information is stored on the stack, such as who called the current function, so PAWN knows where to return to. If you use too much memory, because of the way information is allocated, you can overwrite the stack information, returning to a random point in code and almost certainly crashing. At the very least you will get corrupted data where it's been overwritten by other data. When people get this message the standard advice is to use "#pragma dynamic", which is a workaround, not a fix - I find it very odd that something the size of YSI can not generate this error but people's tiny scripts can, don't you?
You probably have some excessively declared arrays within a function somewhere I would think maybe it's something else but that is my first thought.


Re: Heap underflow issue. - fonia5 - 11.10.2014

I was thinking the same but i don't have a clue how to fix this issue because i never had it before.
I have seen a old thread about this error spamming the console somebody said it was the MYSQL database i have messaged ****** lastnight but he as not messaged me back yet.


[edit] i was correct it is the mysql database am trying to fix it.


Re: Heap underflow issue. - Pottus - 11.10.2014

Try moving large arrays outside of functions for instance.

This will generate an error.
pawn Код:
main() {
    new test[20000];
    for(new i = 0; i < 20000; i++) test[i] = i;
}
This will not
pawn Код:
new test[20000];
main() {
    for(new i = 0; i < 20000; i++) test[i] = i;
}



Re: Heap underflow issue. - fonia5 - 11.10.2014

Alright i will try this now also this only started to happen when i added some mapping's

Alright it's doing this now

[13:58:15] [debug] #0 00000008 in public RefuelCheck () at \pawno\include\float.inc:108
[13:58:16] [debug] Run time error 8: "Heap underflow"

i wonder if it's something to do with the include float.inc


EDIT FIXED it was the include.


Re: Heap underflow issue. - Pottus - 11.10.2014

Does it work without using #pragma dynamic now ?


Re: Heap underflow issue. - fonia5 - 11.10.2014

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Does it work without using #pragma dynamic now ?
might do i will remove it.

here is what i got.

[14:31:41] [SQL] Connection to "localhost" passed!
[14:31:42] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[14:31:42] [debug] Stack pointer (STK) is 0x8137C0, heap pointer (HEA) is 0x823050
[14:31:42] [debug] AMX backtrace:
[14:31:42] [debug] #0 ?? in main ()
[14:31:42] Script[gamemodes/roleplay.amx]: Run time error 3: "Stack/heap collision (insufficient stack size)"
[14:31:42] Number of vehicle models: 1

that's without the #pragma


Re: Heap underflow issue. - Pottus - 11.10.2014

Ya you need to move some large variable arrays outside of the function it would seem.


Re: Heap underflow issue. - fonia5 - 11.10.2014

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Ya you need to move some large variable arrays outside of the function it would seem.
True but i don't no were it's coming from i mean which part of code etc,


Re: Heap underflow issue. - Pottus - 11.10.2014

Put in prints in all your functions example to find it.

print("Debug::Myfunction");