0

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...

Memorysnapshot1

Memorysnapshot2

memoryProfile

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??

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.