javascript - Processing.js - Is there a destructor? -


this might naive question, there destructor in processing.js? know regular processing java-based there isn't destructor, i'm not sure if processing.js runs same way.

just it's here, here's class want build destructor for, if needed:

// obstacle class class obstacle {     float r,g,b;     float x, y, w, h;     float speed;      obstacle(float x_pos, float y_pos, float width, float height, float sp) {         // initialize color         r = random(255);         g = random(255);         b = random(255);          // initial size         w = width;         h = height;          // initial position         x = x_pos;         y = y_pos;          // initialize speed         speed = sp;     }      void update() {         y += speed;     }      void draw() {         fill(r,g,b);         rect(x,y,w,h);     } } 

processing.js doesn't control memory allocation or cleanup, it's left javascript engine. once remove references object, js engine queue object garbage collection, , free memory whenever needs to, afterwards.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -