Open bruunotrindade opened 2 years ago
Already reported at https://github.com/pawn-lang/YSI-Includes/issues/564 I hope it will be fixed soon.
I've put YSI_NO_HEAP_MALLOC
back in. That was always the vastly more stable method.
I also just discovered that the default slop space (space reserved in the heap for callback parameters) was very small (only ~256 bytes (just 64 cells)), which will be blown with any reasonable string. So the other thing to try is:
#define YSI_DEFAULT_MALLOC (2047)
#define YSI_YES_HEAP_MALLOC
That should work with the old and new versions. And I just increased the default to this anyway.
Edit: I think the comments were misleading even me and it was 256 cells, not 256 bytes. Still not a huge amount, but does mean that 2047
can probably come down to something more reasonable like 511
.
Basically, the new version uses the heap, but the VM clears the heap at the end of every top-level callback (easy way to ensure consistency). So every time a new callback is called its reference parameters (i.e. arrays and strings) are inserted at the start of the heap, which clobbers the old malloc values that were there. To combat this I just allocate a block at the start of the malloc memory and abandon it, leaving it free to be used by different callback parameters. I just think there wasn't enough space here for large parameters. There's also code injected in to every public function to restore the previous malloc heap locations.
After some time using y_dialogs, my server started to freeze and I found by crash detect that it was caused by Malloc_Allocate called by y_dialogs.
Crash detect stacktrace:
This problem was also mentioned in one comment in this issue: https://github.com/pawn-lang/YSI-Includes/issues/564
Does anyone know any solution to keep using y_dialogs? My solution was back to normal dialogs.