@TheoAllen it is a bit tricky, basically ruby GC should theoretically release allocated memory automatically, but, unfortunately, that much does not happen as often as required, leading to increased memory usage over time. There is no need for a memory leak, this is just how ruby works. Of course, there are ways to address something like this, but not all of them are easily accessible to RPG Maker users.
The easiest one is probably to have the GC handle as little dynamic memory as possible, minimizing the amount of wasted memory. A good solution in this situation would be setting the number of owned items of a certain type to 0 and then only show those with a quantity higher than 0 in the inventory. This way there is no need to delete pairs from the hash table and there is no need to rely on the garbage collector to release that memory. After all the maximum amount of different items that the hash can store is well known (the total amount of items in the database), there is no way that you can go higher than that.
EDIT
In the first example, where the whole hash table was cleared using
the result is that your memory is full of arrays (hash key/item pairs are arrays) and you have to hope that the garbage collector clears them all....which might take quite a long time.
Clearing items one by one is not ideal either though, and I edited my post above to mention that, as the gain_item method simply removes the key/item pair from the hash table, leaving that array in your memory to wait until the garbage collector decides to do its work.
Something has been done in later versions of ruby to address this problem (2.2 if I am not wrong and something is being done for ruby 2.7), but RGSS uses ruby 1.9.2, which still has a lot of problems with that.
EDIT 2
Keep in mind that, since it is not a memory leak, unused memory does get released at some point, the problem is when and how. When it happens you might have a lot of allocated memory for no real purpose. The sooner you reach that point, the earlier the garbage collector has to run more frequently to clear it. And scanning your whole memory is not exactly "fast", the lesser you do it, the better.
EDIT 3
If you are interested you can read something about this
here. As you can see, the amount of wasted memory can be more than 30 times the amount of real memory used, making it quite a big issue.
@Roninator2 thank you for testing the code, unfortunately, as stated in my previous post (after editing it), I have realized that the gain_item method calls the delete method internally, making it the same as kyonides solution. That being the case, his solution is shorter to write so it is better. Unless the OP wants to change how the engine handles items completely, addressing the issue with the garbage collector, there is no other way to do that.