# Possible bug in the MAP.Remove or Map.Add function (blueprint)?

**URL:** <https://forums.unrealengine.com/t/possible-bug-in-the-map-remove-or-map-add-function-blueprint/396225>\
**Category:** Blueprint\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [June 16, 2017, 8:33am UTC](https://forums.unrealengine.com/t/possible-bug-in-the-map-remove-or-map-add-function-blueprint/396225 "2017-06-16T08:33:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FreemanCIT](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FreemanCIT](https://forums.unrealengine.com/u/FreemanCIT)\
**Post date:** [June 16, 2017, 8:33am UTC](https://forums.unrealengine.com/t/possible-bug-in-the-map-remove-or-map-add-function-blueprint/396225/1 "2017-06-16T08:33:33Z")

</div>

Hello,  
I got a strange bug, ending with editor complete freeze on play, that I track to be related to the MAP type usage in blueprint.

My scenario : I used a map to handle an inventory. My map associate an “name”, which is the key, to a struct describing an inventory slot.

While stress testing the drag and drop mecanism of my inventory (frequent item displacement beetwen “slots”), I remove and re-add map entry at a quite high frequency. On a irregular basis, after 2 to 8 tries, the game (PIE) freeze. I must kill the UE process to recover.

I change my code to use the MAP only to store Name-Index (which mean I dont remove/add in the MAP frequently), using a standard array to do the real storage, and no bug any more.

I suspect some catch in the remove or the Add function of the MAP type, with some sort of memory leak…

This bug may be reproduced by performing many remove on a MAP with a loop, but I didn’t took time to test.

Best regards, and thank you for such a beautiful engine,
