Re: [Flashcoders] BitmapData.dispose()
I'm not sure if its completely necessary, but when I use it, and check the activity monitor, my cpu usage drops considerably. - Ben I've only just noticed the dispose() method of the BitmapData object. Is it strictly necessary? That is: if I just let a BitmapData object get garbage collected, will the memory fail to be released? And if not, why would we need this method instead of plain old delete? Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[FlashCoders] BitmapData.dispose()
Hello, Quick question. private function createBitmap():Void { var bitmap:BitmapData = new Bitmap(200, 200, false, 0xFF); clip.attachBitmap(bitmap, 0); } If I never execute .dispose() on the bitmap, does it remain in memory? It seems logical to me that it remains there only until the function is finished. It's a local variable so I would expect the memory gets freed as soon as the local variable dies. Thanks! Regards, Dimtirios Bendilas ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [FlashCoders] BitmapData.dispose()
Hello, It looks that the garbage collector deal different with BitmapData objects. You can easily use some Gigabytes of memory putting this code in some onEnterFrame loop for example. You can find more about this issue on Grant Skinner blog...it was discussed there a time ago. http://www.gskinner.com/blog/archives/2005/10/major_flash_pla.html Good luck! Andre On 3/24/06, Dimitrios Bendilas [EMAIL PROTECTED] wrote: Hello, Quick question. private function createBitmap():Void { var bitmap:BitmapData = new Bitmap(200, 200, false, 0xFF); clip.attachBitmap(bitmap, 0); } If I never execute .dispose() on the bitmap, does it remain in memory? It seems logical to me that it remains there only until the function is finished. It's a local variable so I would expect the memory gets freed as soon as the local variable dies. Thanks! Regards, Dimtirios Bendilas ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- /* André Nachtigall Tessmann [EMAIL PROTECTED] +55 53 81165721 */ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [FlashCoders] BitmapData.dispose()
Yes, BMP Obj remains in memory, you need to have a reference to that Object so you can dispose it later. import flash.display.BitmapData; var bitmap:BitmapData; function createBitmap():Void { bitmap = new BitmapData(500, 500, false, 0xFF); _root.attachBitmap(bitmap, 0); } clickObj = {}; clickObj.onMouseDown = function() { _root.bitmap.dispose(); } Mouse.addListener( clickObj ); createBitmap(); On 3/24/06, Dimitrios Bendilas [EMAIL PROTECTED] wrote: Hello, Quick question. private function createBitmap():Void { var bitmap:BitmapData = new Bitmap(200, 200, false, 0xFF); clip.attachBitmap(bitmap, 0); } If I never execute .dispose() on the bitmap, does it remain in memory? It seems logical to me that it remains there only until the function is finished. It's a local variable so I would expect the memory gets freed as soon as the local variable dies. Thanks! Regards, Dimtirios Bendilas ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [FlashCoders] BitmapData.dispose()
bitmapData remains in memory, even when the bitmapData objects refrence count reaches zero, in which case, dispose() can no longer be called on the bitmapData object, causing memory leak. There is more on this subject, you should find more information on it searching google, the flashcoders archive, and so forth. To my knowledge, this behavior persists in the newest commerical player release. M. On 3/24/06, Dimitrios Bendilas [EMAIL PROTECTED] wrote: Hello, Quick question. private function createBitmap():Void { var bitmap:BitmapData = new Bitmap(200, 200, false, 0xFF); clip.attachBitmap(bitmap, 0); } If I never execute .dispose() on the bitmap, does it remain in memory? It seems logical to me that it remains there only until the function is finished. It's a local variable so I would expect the memory gets freed as soon as the local variable dies. Thanks! Regards, Dimtirios Bendilas ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [FlashCoders] BitmapData.dispose()
Thank you all guys. I think this makes it rather difficult to deal with if you use bitmaps a lot. I've built a complex RasterText class that works with bitmaps and in some cases it's very useful to render the text, get the resulting bitmap and then destroy the RasterText instance. The bitmap could then be attached on a movieclip. If you do that with dozens of bitmaps it's a pain to keep track of all of them in seperate variables. Anyway, Thanks a lot! Regards, Dimitrios Bendilas - Original Message - From: André Nachtigall Tessmann [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Friday, March 24, 2006 9:01 PM Subject: Re: [FlashCoders] BitmapData.dispose() Hello, It looks that the garbage collector deal different with BitmapData objects. You can easily use some Gigabytes of memory putting this code in some onEnterFrame loop for example. You can find more about this issue on Grant Skinner blog...it was discussed there a time ago. http://www.gskinner.com/blog/archives/2005/10/major_flash_pla.html Good luck! Andre On 3/24/06, Dimitrios Bendilas [EMAIL PROTECTED] wrote: Hello, Quick question. private function createBitmap():Void { var bitmap:BitmapData = new Bitmap(200, 200, false, 0xFF); clip.attachBitmap(bitmap, 0); } If I never execute .dispose() on the bitmap, does it remain in memory? It seems logical to me that it remains there only until the function is finished. It's a local variable so I would expect the memory gets freed as soon as the local variable dies. Thanks! Regards, Dimtirios Bendilas ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- /* André Nachtigall Tessmann [EMAIL PROTECTED] +55 53 81165721 */ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com