All sounds strange. jqGrid works not clean with memory. Nevertheless I don't think that increasing memory in 30 MB on after every opening of dialog could be explained by jqGrid only. The grid which you use don't contains rowNum
. So the default value 20 (see the documentation) will be used. You don't use loadonce: true
option, so 'MyWebService.asmx/MyMethod'
used as the URL in the grid should returns about 20*4 cell values (3 columns + id column). Such response and all DOM structures created by jqGrid can't take 30 MB memory.
So I suppose that the reason of the problem could be other as jqGrid. You can use Fiddler, Developer Tools of IE or Chrome to trace HTTP traffic. I recommend you to verify responses from 'MyWebService.asmx/MyMethod'
and from 'MyWebService.asmx/GetAdditionalData'
. It can be that some response contains too much data. Reducing of data will not really solve the problem, but 30 KB of memory leaks will be not so important as leaks of the size 30 MB. By the way you can use userData
and refresh the title of the dialog (make the same set of dialog option "title") inside of loadComplete
. In the way you would save synchronous (async: false
???) Ajax call.
Additionally I would recommend you to change (temporary, only for the test) the datatype
option from "json"
to "local"
. No request to the URL 'MyWebService.asmx/MyMethod'
will be done in the case and you could verify whether call of the method and filling the grid data are responsible for 30 MB which is your main problem.
You would recommend you to use deepempty: true
option of jqGrid additionally.
If all your test will show that jqGrid is do responsible for memory leaks then you will have to replace $(gridID).jqGrid('GridUnload');
call to recursive cleaning of all DOM structures (cells and rows) created by jqGrid. I hope that it will be not needed.