-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image Memory Leak #150
Comments
thanks for the report i'll take a peek tomorrow |
Having similar results, with the past couple versions, at least. Hadn't found the time to pull it out of my code to explicitly test it (nicely done, @drwheeler). |
it's probably something pretty obvious, just need a minute to check it out, should have time today |
My C is incredibly subpar, so I'm not sure how to implement this correctly, but it seems to me that the data pointer is never freed when an image is successfully loaded. I assume that should happen in the destructor, but that's where my capability seems to fail miserably. To test, in Image.cc, in the Unfortunately, doing it there means there is no output, likely because according to the docs:
I could go on about my silly attempts to initialize *data in the constructor and free it in the destructor, but I assume you get the idea. One of these days pointers may actually make some sense to me. Obviously not today. |
I also did a free(data) move as enobrev mentioned. In
Followed by a node-waf configure build, that change seemed to resolve the leak for my specific usage of this library. I saw the memory leak in XCode Instruments while looking at Malloc 's while attached to the node.js process (which is what lead me to the that loadJPEGFromBuffer). I can't see what broke. I assume I'm doing something else wrong. It seemed to work for my simple case of doing a resize from buffer passed from redis before sending on to the browser through express. Not isolated at all, but code is here >> https://github.com/proksoup/thlip.com/blob/ffcb87ab723b2a98a74c2a9182075f6c2fc584b9/app.coffee#L265-L278 |
… from @AllYearbooks fork without the mime-stuff.
The issue is still there: function loadImage(url, finish){ |
Storing the onerror/onload callbacks in Persistent handles means they will never be GC'ed. If those functions have references to the image, then the image will never be GC'ed either. Fixes Automattic#785 Fixes Automattic#150 (for real)
Storing the onerror/onload callbacks in Persistent handles means they will never be GC'ed. If those functions have references to the image, then the image will never be GC'ed either. Fixes Automattic#785 Fixes Automattic#150 (for real)
This simple little loop chews through all the memory on my Debian box. I'm nulling the Image instance every time through.
Running with node --trace_gc tst6.js shows that garbage collection is happening but this script will use 2GB of memory in short order then get killed. In real life the interval would be 10s
...
setInterval(timestampImage, 100);
function timestampImage() {
var cameraImage = new Image;
}
function onLoad() {
...
Put the image in a canvas, add a text timestamp, save
...
}
https://gist.github.com/1720778#file_timestamp.js
The text was updated successfully, but these errors were encountered: