[GIS] Cannot delete in_memory workspace

arcgis-10.3arcpydeleteerror-000725in-memory

I wanted to use in_memory workspace, however I can't clear it. No matter if I use in Python window, in ArcMap this:

arcpy.Buffer_analysis("something", "in_memory/buffer", 399)
arcpy.Delete_management("in_memory")
arcpy.Buffer_analysis("something", "in_memory/buffer", 3345)

or this:

arcpy.Buffer_analysis("something", "in_memory/buffer", 399)
arcpy.Delete_management("in_memory/buffer")
arcpy.Buffer_analysis("something", "in_memory/buffer", 3345)

I get the following error:

ExecuteError: ERROR 000725: Output Feature Class: Dataset in_memory\buffer already exists.  

In_memory gets normally cleared when I restart ArcMap.
How can I clear in_memory?

EDIT:

Output from answer proposed by KHibma:

>>> arcpy.CopyFeatures_management("linie", "in_memory/foo1")
<Result 'in_memory\\foo1'>
>>> arcpy.Exists("in_memory/foo1")
True
>>> arcpy.Delete_management("in_memory")
<Result 'true'>
>>> arcpy.Exists("in_memory/foo1")
True
>>> arcpy.Delete_management("in_memory/foo1")
<Result 'true'>
>>> arcpy.Exists("in_memory/foo1")
True

So it seems that neither of deleting from in_memory methods is working at all.

Best Answer

The workflow you describe works as expected for me in the Python window. Perhaps copy/paste all of the python window session into your question, showing the result of each operation.

In short, yes, you can delete items out of the in_memory workspace.

>>> arcpy.CopyFeatures_management(r"Exterior Editing\Trees", "in_memory/foo1")
<Result 'in_memory\\foo1'>
>>> arcpy.Exists("in_memory/foo1")
True
>>> arcpy.Delete_management("in_memory")
<Result 'true'>
>>> arcpy.Exists("in_memory/foo1")
False
>>> arcpy.CopyFeatures_management(r"Exterior Editing\Trees", "in_memory/foo1")
<Result 'in_memory\\foo1'>
>>> arcpy.Exists("in_memory/foo1")
True
>>> arcpy.Delete_management("in_memory/foo1")
<Result 'true'>
>>> arcpy.Exists("in_memory/foo1")
False
Related Question