jQueryUI 'unloading'/memory use
I'm rather a novice when it comes to Javascript/jQuery etc., so please forgive me if this question betrays a fairly serious lack of understanding about how JS works.
I'm developing a site which employs jQuery's getJSON method to get information from a set of PHP scripts - including jQueryUI dialogs (in short, the JSON data includes the jQuery code required to set up the dialog, as well as the actual HTML for the dialog box(es); the jQuery code is wrapped in a 'script' tag and inserted into the head element, while the HTML is inserted into a div element in the body). When fresh data is loaded, the element containing the dialog is emptied.
My concern is over what happens to the jQuery code which was used to set up and operate the dialog: does JS just quietly 'unload'/'delete' it, or is it still running in the background? In other words, is there something I need to do to stop the site from turning into a resource hog the more the user uses it, or is JS doing those things for me already?
I'd be very grateful for any help anyone might be able to offer.