Blender crashes from replacing mesh data via script
You can just use the operator orphans_purge to make sure orphan meshes get freed. I don't think the impact on performance would be noticeable unless you have a huge scene.
obj = bpy.data.objects.get(name)
mesh = bpy.data.meshes.new(name)
if obj:        
    obj.data = mesh        
    bpy.ops.outliner.orphans_purge()
else:
    obj = bpy.data.objects.new(name, mesh)
    bpy.context.scene.collection.objects.link(obj)

mesh.from_pydata(verts, [], faces)

Also, a few tips :

Avoid Try/Except when using dictionaries, prefer using get(key, default)
Prefer foo is not None to foo != None
Prefer if bar: to if bar == True:

In simple blender scripts you shouldn't have to use Try/Except unless you specifically know which kind of exception your code is going to throw, and even then you should be able to not use it in most cases.