Possible Plugin-Related Memory Issue (AmmoHUD & ItemRetriever) Causing OOMNot An Issue

Since the latest Rust update, my server has been experiencing abnormal memory usage leading to Out of Memory errors and shutdowns. After reviewing the logs, I have identified repeated OOM errors occurring specifically in the plugins AmmoHUD v1.2.1 and ItemRetriever v0.7.x.

Observed behavior:

  • Both plugins are triggering Out of memory errors during the OnActiveItemChanged and OnInventoryAmmoFind hooks.

  • The stack traces show repeated calls to System.Collections.Generic.List<Item>.set_Capacity, suggesting that item lists are continuously expanding without proper release.

  • This happens multiple times in a day (e.g., 05:17 and 13:28), not as a one-time spike.

  • RustAdmin reports abnormal memory usage values before shutdown, e.g., "Your server is using: 96782.96MB Memory".

    2025/08/8 13:28:04 | Failed to call internal hook 'OnActiveItemChanged' on plugin 'AmmoHUD v1.2.1' [2268037981] (Out of memory)
    at void System.Collections.Generic.List<Item>.set_Capacity(int value)
    at void System.Collections.Generic.List<Item>.EnsureCapacity(int min)
    at void System.Collections.Generic.List<Item>.AddWithResize(Item item)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Oxide.Plugins.ItemRetriever.FindPlayerAmmo(BasePlayer player, AmmoTypes ammoType, List<Item> collect) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 526
    at object Oxide.Plugins.ItemRetriever.OnInventoryAmmoFind(PlayerInventory inventory, List<Item> collect, AmmoTypes ammoType) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 134
    at object Oxide.Plugins.ItemRetriever.InternalCallHook(uint hook, object[] args) in ItemRetriever.cs/Internal:line 209
    at void System.Collections.Generic.List<Item>.set_Capacity(int value)
    at void System.Collections.Generic.List<Item>.EnsureCapacity(int min)
    at void System.Collections.Generic.List<Item>.AddWithResize(Item item)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at int BaseProjectile.GetAvailableAmmo()
    at void Oxide.Plugins.AmmoHUD.UpdateUI(BasePlayer player, AttackEntity item, UpdateEnum uiToUpdate) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/AmmoHUD.cs:line 664
    at void Oxide.Plugins.AmmoHUD.OnActiveItemChanged(BasePlayer player, Item oldItem, Item newItem) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/AmmoHUD.cs:line 482
    at object Oxide.Plugins.AmmoHUD.InternalCallHook(uint hook, object[] args) in AmmoHUD.cs/Internal:line 106
    2025/08/8 13:28:04 | Failed to call internal hook 'OnInventoryAmmoFind' on plugin 'ItemRetriever v0.7.5' [2374724162] (Out of memory)
    at void System.Collections.Generic.List<Item>.set_Capacity(int value)
    at void System.Collections.Generic.List<Item>.EnsureCapacity(int min)
    at void System.Collections.Generic.List<Item>.AddWithResize(Item item)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Oxide.Plugins.ItemRetriever.FindPlayerAmmo(BasePlayer player, AmmoTypes ammoType, List<Item> collect) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 526
    at object Oxide.Plugins.ItemRetriever.OnInventoryAmmoFind(PlayerInventory inventory, List<Item> collect, AmmoTypes ammoType) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 134
    at object Oxide.Plugins.ItemRetriever.InternalCallHook(uint hook, object[] args) in ItemRetriever.cs/Internal:line 209
    
    
    2025/08/8 05:17:20 | Failed to call internal hook 'OnActiveItemChanged' on plugin 'AmmoHUD v1.2.1' [2268037981] (Out of memory)
    at void System.Collections.Generic.List<Item>.set_Capacity(int value)
    at void System.Collections.Generic.List<Item>.EnsureCapacity(int min)
    at void System.Collections.Generic.List<Item>.AddWithResize(Item item)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Oxide.Plugins.ItemRetriever.FindPlayerAmmo(BasePlayer player, AmmoTypes ammoType, List<Item> collect) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 620
    at object Oxide.Plugins.ItemRetriever.OnInventoryAmmoFind(PlayerInventory inventory, List<Item> collect, AmmoTypes ammoType) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 228
    at object Oxide.Plugins.ItemRetriever.InternalCallHook(uint hook, object[] args) in ItemRetriever.cs/Internal:line 212
    at void System.Collections.Generic.List<Item>.set_Capacity(int value)
    at void System.Collections.Generic.List<Item>.EnsureCapacity(int min)
    at void System.Collections.Generic.List<Item>.AddWithResize(Item item)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at int BaseProjectile.GetAvailableAmmo()
    at void Oxide.Plugins.AmmoHUD.UpdateUI(BasePlayer player, AttackEntity item, UpdateEnum uiToUpdate) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/AmmoHUD.cs:line 664
    at void Oxide.Plugins.AmmoHUD.OnActiveItemChanged(BasePlayer player, Item oldItem, Item newItem) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/AmmoHUD.cs:line 482
    at object Oxide.Plugins.AmmoHUD.InternalCallHook(uint hook, object[] args) in AmmoHUD.cs/Internal:line 106
    2025/08/8 05:17:20 | Failed to call internal hook 'OnInventoryAmmoFind' on plugin 'ItemRetriever v0.7.4' [2374724162] (Out of memory)
    at void System.Collections.Generic.List<Item>.set_Capacity(int value)
    at void System.Collections.Generic.List<Item>.EnsureCapacity(int min)
    at void System.Collections.Generic.List<Item>.AddWithResize(Item item)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Item.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void ItemContainer.FindAmmo(List<Item> list, AmmoTypes ammoType)
    at void Oxide.Plugins.ItemRetriever.FindPlayerAmmo(BasePlayer player, AmmoTypes ammoType, List<Item> collect) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 620
    at object Oxide.Plugins.ItemRetriever.OnInventoryAmmoFind(PlayerInventory inventory, List<Item> collect, AmmoTypes ammoType) in D:/TCAFiles/Users/kentk/5128864/carbon/plugins/ItemRetriever.cs:line 228
    at object Oxide.Plugins.ItemRetriever.InternalCallHook(uint hook, object[] args) in ItemRetriever.cs/Internal:line 212

     

    My request:

    • Could you confirm if this is a known issue with either AmmoHUD or ItemRetriever after the recent Rust update?

    • Is there a recommended fix or update to prevent uncontrolled memory growth in these hooks?

    • In the meantime, would you recommend disabling one or both plugins to stabilize the server?

I have taken a look at the code of both plugins and the relevant Rust code, and I'm not sure the plugins are the cause of the OOM issue. These are frequently called hooks so it's possibly a coincidence.

The BaseProjectile.GetAvailableAmmo() method acquires a pooled list which is then populated by Item Retriever with the applicable ammo items. If the list did not have sufficient capacity to hold all the ammo items, it would need to be resized. The pooled list is released and emptied at the end, so I'm not seeing a way for memory usage to grow significantly over time.

On the subject of pooling, the lists in the pool never shrink their capacity even when they are emptied, so if there is a case where the amount of ammo items is very large, it's remotely possible that eventually every list in the pool would be resized to that size which could take increased memory, but it wouldn't be enough to reach the amount you posted as the pools have a finite size. If there were a bug leading to the pool size reaching the max, additional lists would be created on-demand and then garbage collected some time later so you wouldn't see OOM.

Feel free to disable one or both plugins, as they are simply convenience plugins (especially Ammo HUD) and therefore your players should be able to go without them for a bit while you troubleshoot.

Hi WhiteThunder this plugin has an error after the new update its now clashing with trying to reload our weapons, all the animation work but its dropping ammo instead of reloading the mag, when I pull this plugin runs fine again, so this is triggering a nil reload of your weapons.... hope you can solve this soon as this is a great plugin. Thanks

rJCLtr0q2zZqqYp.jpg sicksake

Hi WhiteThunder this plugin has an error after the new update its now clashing with trying to reload our weapons, all the animation work but its dropping ammo instead of reloading the mag, when I pull this plugin runs fine again, so this is triggering a nil reload of your weapons.... hope you can solve this soon as this is a great plugin. Thanks

Please do not hijack unrelated threads. I released a fix for the reload issue days ago (before the force wipe) and there are two other threads about it.

Sorry only new here

i had this same error happen yesterday, then the server crashed due to being out of memory, on a 128gb system. the memory usage spiked to almost 16gb, then the server froze. ive uninstalled this for now as it was causing a bunch of console spam so far the ram usage hasnt spiked.

I saw an update to the Server Rewards plugin which fixed a pooling issue where instances of List<Item> were being added to the pool twice. This is relevant because it is the same object type as used by the OnInventoryAmmoFind hook which was seen in the error stacktrace above. Most plugins that use pooling, including Server Rewards, used shared Facepunch-provided pools so mishandling of pools in one place can affect other plugins or internal Rust functions. Mishandling of pooled objects can cause a multitude of consequences that are difficult to debug, so I'm not sure if that specific issue (double pooling) could have caused the OOM issue, but you should definitely update Server Rewards if you are using it.

Locked automatically