Do Python dictionaries have all memory freed when reassigned?
<p>Working in Python. I have a function that reads from a queue and creates a dictionary based on some of the XML tags in the record read from the queue, and returns this dictionary. I call this function in a loop forever. The dictionary gets reassigned each time. Does the memory previously used by the dictionary get freed at each reassignment, or does it get orphaned and eventually cause memory problems?</p>

<pre><code>def readq():
    qtags = {}
    # Omitted code to read the queue record, get XML string, DOMify it

    qtags['result'] = "Success"
    qtags['call_offer_time'] = get_node_value_by_name(audio_dom, 'call_offer_time')
    # More omitted code to extract the rest of the tags

    return qtags

while signals.sigterm_caught == False:
    tags = readq()
    if tags['result'] == "Empty":
        time.sleep(SLEEP_TIME)
        continue
    # Do stuff with the tags
</code></pre>

<p>So when I reassign tags each time in that loop, will the memory used by the previous assignment get freed before being allocated by the new assignment?</p>
