[ 2 posts ]

AliRamezani

  • Joined: Fri Jan 20, 2012 5:06 am
  • Posts: 8
  • Offline
  • Profile

rising memory usage - why?

Post Posted: Mon Jun 04, 2012 4:35 am
+0-
Hello community!

I struggle with rising memory usage in my yui3 web application. I reduced the modules to simplify troubleshooting.


Here ist my main call function - is called only once after loading the page:

Code:
YUI().use('bpm-core', 'bpm-navigation-base', function (Y) {

    new Y.bpm.bpm_navigation_base();
    new Y.bpm.bpm_core();

    var navigation = Y.bpm.bpmNavigation;
   
});


my navigation module:

Code:
        initializer: function (config) {

            var self = this;
            Y.namespace(Y.BPM_NAMESPACE).bpmNavigation = this;

            var router = new Y.Router();
            this.set("router", router);
            this._initRoutes();

        },

        navigate: function (url) {
            var self = this;
            Y.bpm.bpmCore.ioGet(url, function (result) {


                var node = Y.Node.create(result);

                var body = self.get("body");
                body.empty(true);
                body.append(node);

                node = null;


            });


        },

        _navigateRoute: function (req) {
            var self = Y.bpm.bpmNavigation;
            var url = null;

            switch (req.path) {
                case "/m":
                    url = "/Management" + req.query.folder;
                    //management masken
                    self.navigate(url);
                    break;
            }

        },

        _initRoutes: function () {
            var self = this;
            var router = this.get("router");
            router.route("/m", self._navigateRoute);

            if (router.get('html5')) {
                router.upgrade();
            } else {
                router.dispatch();
            }

            var anchors = this.get("navigation").all("a");
            anchors.each(function (anchor) {
                anchor.on("click", function (event) {
                    event.preventDefault ? event.preventDefault() : event.returnValue = false;

                    var href = anchor.getAttribute("href");

                    router.replace(href);
                }, self);
            });
            anchors = null;

        }


my io:get method:
Code:

        ioGet: function (uri, onComplete) {

            var sync = true;

            uri = uri + '?t=' + new Date().valueOf().toString();

            var cfg = {};

            if (Y.Lang.isFunction(onComplete)) {
                sync = false;
                cfg = { sync: sync,

                    on: {
                        complete: function (transactionid, response, arguments) {
                            var result = response.responseText;

                            if (Lang.isString(result) && result.length > 1) {
                                if (result.substr(0, 1) == '{' || result.substr(0, 1) == '[') {
                                    result = Y.JSON.parse(result);
                                }
                            }

                            onComplete(result);
                        }
                    }
                };


            }
            else {
                sync = true;
                cfg = { sync: sync };
            }

            var request = Y.io(uri, cfg);

            if (sync) {
                return Y.JSON.parse(request.responseText);
            }
            else {
                return request;
            }

        }


at the start of the page i have a normal usage of memory but after each call of navigate method my memory usage is increasing and increasing and will no longer reset by the garbagtecollector.

AliRamezani

  • Joined: Fri Jan 20, 2012 5:06 am
  • Posts: 8
  • Offline
  • Profile
Tags:

Re: rising memory usage - why?

Post Posted: Wed Jun 06, 2012 1:13 am
+0-
Hello again,

after about 100 clicks i have a memory usage by 55 MB.

and it is without any io-request etc. only a simple node operation...!

with all my other objects that i have, it reaches with the same clicks over 300 MB or 400 MB.

testet in Chrome Browser vers. 19.

What is wrong here? please help ...

I think I'm doing what fundamentally wrong in the handling of GC?

thank you.
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum