in mvc web app, first chrome memory snapshot is ~ 51mb
after i call ajax to re render partialView, second snapshot take double or more! ~ 100bm.
and in every call partialview memory usage get larger and larger...
i search with AI Asist and add some function to solve memory leak, but not affect.
function reloadPartialView() {
var container = $('#partial-tab');
//**** AI Suggest this lines: *****//
const elements = container[0].getElementsByTagName('*');
for (let el of elements) {
const newEl = el.cloneNode(false); // Clone without children/events
el.parentNode.replaceChild(newEl, el);
}
container.find('*').off(); // Remove all jQuery handlers
$(container).find('*').addBack().off().removeData();
container.empty();
$(container).innerHTML = '';
//**** End Suggest ****//
var link = `/controller/method/GetMyView`;
$.ajax({
url: link,
type: "Get",
success: function (result) {
$(container).empty().html(result);
},
});}
how solve this??


