[YSI] Inline + General - 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: [YSI] Inline + General (
/showthread.php?tid=642287)
Re: [YSI] Inline + General -
Dayrion - 04.10.2017
Quote:
Originally Posted by Dayrion
---------------------
I still have a warning which I don't know how to solve:
[10:27:55] *** YSI Warning: y_malloc set up via "CallLocalFunction", memory corruption is a remote possibility
What "memory corruption" means? What should I do?
---------------------
Finally, I have one query inline which doesn't work. It is never called. Other inline callback are called.
PHP Code:
mysql_format(database, query, sizeof(query), "SELECT * FROM `gtrp_factions_ranks` WHERE `FactionSQLID` = %i ORDER BY `gtrp_factions_ranks`.`Rank` ASC", j);
inline OnRanksLoading(factionID)
{
J::D("Inside inline: %s", FactionInfo[j][fName], j);
new temporary,
num_ranks = cache_num_rows();
if(!num_ranks)
{
CreateRanksForFactions(factionID);
return J::D("No ranks loaded for %s. They have been created.", GetFactionName(factionID));
}
for(new k; k != num_ranks; k++)
{
cache_get_value_int(k, "Rank", temporary);
cache_get_value(k, "RankName", f_RankName[factionID][temporary], MAX_FAC_RANK_NAME);
J::D("Rank %i (%s) loaded for %s", temporary, f_RankName[factionID][temporary], GetFactionName(factionID));
}
}
J::D("Faction \"%s\" (id: %i) loaded | Loading ranks 2.0", FactionInfo[j][fName], j);
mysql_pquery_inline(database, query, using inline OnRanksLoading, "i", j);
No errors, no warnings, nothing in the logs
|
^ This inline callback seems to works randomly.
UP boyz!
Re: [YSI] Inline + General -
Dayrion - 04.10.2017
Quote:
Originally Posted by Y_Less
That warning comes when you use y_malloc from OnGameModeInit, but it is called by CallLocalFunction, which alters the heap. Try moving the YSI includes to after a_samp and before most other things (except fixes.inc).
|
Thanks again lol. I +rep you. I can't for Misiur, unfortunately.
Crashdetect must be included before too.
Re: [YSI] Inline + General -
Dayrion - 20.10.2017
Quote:
Originally Posted by Y_Less
Do you use "malloc" in OnGameModeInit? And that includes anything that uses "inline". If so, that might be a problem. However, I've thought of a new solution that solves two problems at once, including this one.
|
There is the correct order to avoid any warnings:
PHP Code:
#include <a_samp>
#include <profiler>
#include <crashdetect>
#define DYNAMIC_MEMORY 12500
#include <YSI\YSI\y_malloc>
#include <YSI\YSI\y_iterate>
#include <YSI\YSI\y_va>
#include <YSI\YSI\y_inline>
#include <fixes>
#include <a_mysql_yinline>
No I don't directly use y_malloc. I include him for the other YSI's include.
Re: [YSI] Inline + General -
Y_Less - 06.11.2017
I was worried there was an issue with the new fast jump targets code, but I wasn't sure what. I've now determined what the issue is, so I've had to revert that code until a better solution can be found. So unfortunately for now your startups will have to go down again.
Re: [YSI] Inline + General -
Dayrion - 06.11.2017
Quote:
Originally Posted by Y_Less
I was worried there was an issue with the new fast jump targets code, but I wasn't sure what. I've now determined what the issue is, so I've had to revert that code until a better solution can be found. So unfortunately for now your startups will have to go down again.
|
Can't I keep the code until you find a better solution? The actual code can cause issues? If yes, what problems?
Thanks for your works, keep it up :p
Re: [YSI] Inline + General -
Y_Less - 06.11.2017
It is possible that the current code will keep working until I release my current YSI code. The issue was in the code responsible for tracking the size of the stack, but I don't think anything in the current version of YSI relies on that. I was just writing some new (well, modified old) code and needed the stack size information, which is what led me to realise that it was wrong.
So yes, you can probably keep using it for now. I'll try get a better solution before I release the new version, but since the current code works and only affects startup times, it isn't a high priority.