tutorialzine / touchTouch

Touch Optimized Mobile Gallery
179 stars 56 forks source link

Destroy the object and release the resources. #11

Open moiseevigor opened 11 years ago

moiseevigor commented 11 years ago

What will be the correct way to destroy the gallery and release all listeners etc?

martinaglv commented 11 years ago

If the elements TouchTouch is listening on are removed, so are the event listeners. Do you have a specific use case in mind?

moiseevigor commented 11 years ago

Hi, simply it is nice to have a destructor of an object just in case :) Similar to http://api.jqueryui.com/sortable/#method-destroy. So this is just the good practice I suppose.

But I stated the question because of one problem we encounter in life. We're doing single page web application. The user can load and check many galleries of different users, so I'm getting worried about memory consumption and overall performance of the app with many object initialized (some stats: application fully loaded - 110MB, touchTouch initialized with 100 photos and used for some minutes 125-130MB).

Will be difficult to implement the destructor OR reuse the same object with absolute new photo set?

Thank you Martin!