Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

AllocString space recycler


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 494
  • Lokalizacja:AMXX.PL
Offline

Napisano 16.07.2017 15:12

<div><b>[Purpose]</b><br />When we create entities, the general method is just like:<br /><br />new iEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, &quot;info_target&quot;));<br /><br />When we use some fakemeta natives such as set_pev, the module automatically calls EngFunc_AllocString to put the string into the memory.<br /><br />Notice the EngFunc_AllocString, it acts just like : new char[strlen(szValue)+1];<br />But without delete operation.<br />This unlimited allocing operation will finally lead to Cache_TryAlloc error and then the server crashes.<br /><br /><b>[Method]</b><br />So here we'd better to recycle those string pointers.<br />1.Hook EngFunc_AllocString<br />2.Puts new string to memory using original call and store the result<br />3.When we need the same string, return the result from previous call<br /><br /><b>[Installion]</b><br />Since register_forward can't hook calls from engfunc, orpheu(or other module) is need, which can be downloaded in <a href="https://forums.alliedmods.net/showthread.php?t=116393" target="_blank" rel="noopener">https://forums.allie...t=116393</a><br /><br />Download x_stringman.sma and compile it...and install it.<br /><br />And you need the function information(no need for signature), put AllocString file into cstrike/addons/amxmodx/configs/orpheu/functions<br /><br /><b>[CVARs and configs]</b><br />None.<br /><br /><b>[Changelog]</b><br />ver 1.1: Destroy Trie in plugin_end()</div>


<br /> <div style="padding:6px">








<fieldset class="fieldset">
<legend>Attached Files</legend>
<table cellpadding="0" cellspacing="3" border="0">
<tr>
<td><img class="inlineimg" src="https://forums.allie...attach/zip.gif"alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>


<a href="https://forums.allie...cString.zip</a>(273 Bytes)


</td>
</tr><tr>
<td><img class="inlineimg" src="https://forums.allie...attach/sma.gif"alt="File Type: sma" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>

<a href="http://www.amxmodx.o...51"><strong>GetPlugin</strong></a> or
<a href="https://forums.allie...1500393806">GetSource</a> (x_stringman.sma - 1.0 KB)

</td>
</tr>
</table>
</fieldset>


</div>

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych