Memory Leak (Windows CE 5, IE)
Running some code on Internet Explorer on Windows CE 5 and getting the following error:
http://support.microsoft.com/kb/922952
It suggests I "release all dynamically allocated event handlers in the onunload event for the Web page," which I thought would be accomplished with:
- $(window).unload(function (){$( ** selectors for most all bound objects ** ).unbind();
(Not all bound objects, because I have a bound 'back' image/link that I can't unbind - but everything else)
However, I'm losing a not insignificant chunk of memory with each refresh, and it gives me the out of memory error within about a half dozen refreshes. This is the only relevant javascript in the page:
- $(document).ready(function(){
- $(":input").tabEnter(); // this binds things
- load_keyboard_js(); // this too
- focus_click_bindings(); // this too
- // but they all should be eliminated here:
- $(window).unload(function (){
- $('.clear_on_click, .clear_on_click_only, #upc, #form, #cases, #units').unbind();
- });
-
- $("#upc").unbind('blur').bind( // was previously bound
- 'blur',
- function(){
- $(this).val(
- add_zeros($(this).val())
- );
- item_search($(this).val(),true);
- }
- );
-
- $("#upc").focus();
- $("#form").validate(
- {
- focusInvalid:true,errorPlacement:
- function(error,element){
- error.insertAfter(element);$("<br />").insertAfter(element);
- },
- submitHandler:function(form){
- $('#form').ajaxSubmit({
- target:'#main_div',
- success:focus_confirm_link
- });},
- highlight:function(element,errorClass)
- {
- $(element).addClass("invalid_input");
- },
- errorClass:"invalid_input",validClass:"valid_input"});
-
- return false;
- });
Thanks for any help -- I've been stuck on this for weeks and haven't come up with anything.