Flex :: BitmapData Allocates A Lot Of Memory When Created
Feb 2, 2012
I have an application which manipulates high resolution images (something around 100+ megapixels), and I'm having some memory issues. When the BitmapData object is created, it allocates memory to store this image. The problem, is that I already have a ByteArray with this image's pixels (which have something around 400+ MB), so when the BitmapData is created, it allocates memory to store the same data that I have on the ByteArray. After its creation, I can set the pixels from the ByteArray to the BitmapData and free the ByteArray. But this memory peak is, sometimes, causing the runtime to raise an exception, telling that the system is out of memory. Is there any way to tell the BitmapData to use my own ByteArray? Or any other solution that I don't have to use double the memory that I need?
View 1 Replies
Similar Posts:
Apr 12, 2010
I've got a flex component which works pretty well but unfortunately turns into a disaster once used in a datagroup item renderer of about 40-50 items. Essentially it uses bitmapdata to take screenshot of a fully-rendered webpage in mx:HTML (this version of webkit rocks btw, miles better than flex 3). The code is pretty self-explanatory I think. [URL]. I've optimized it all I could, browsed, search for answers and already trimmed it down a lot, I'm desparate to reduce the memory usage (about 600mb after 100 draw). The Garbage collector has little effect.
View 3 Replies
Dec 22, 2011
I've made a mobile version of my software, with low-res images and such, and I can now fully buffer all my content (including a 360 frame animation which is buffered to memory). Problem is, that everytime I update the view, more memory is used.When I write image = new BitmapData();, does it store the previously created BitmapData's in memory? Do I have to flush the memory somehow before I draw my second picture in BitmapData?Example:
ActionScript Code:
// In this example I draw using the same bitmapData several times, also
//overwriting the first image. Do I have to somehow delete the data first, to
[code].....
View 1 Replies
Jul 7, 2011
I have a large sprite...and I'm splitting it into several smaller ones with function bellow. The function works great but the memory usage of my .swf grows dramatically.
private function split_sprite(sp:Sprite,the_parrent:Sprite) {
var region:Rectangle = new Rectangle();
region = sp.getBounds(the_parrent);
[code]....
View 1 Replies
Mar 1, 2010
1: I upload an image
2: Without altering it,I make a copy of it and use it display to users in resized format
note: I won't display the original image.
3:Now when user deletes the resized image,i need to delete the image loaded as bitmap i.e. the original image which i won't be displaying
For that I used bitmap.bitmapData.dispose() method.But,it doesn't free up the memory taken by the bitmap.For instance at initial state the memory usage is 58 Mb and upon loading 3 images the size increases to 87 Mb.And when I delete all the images the size decreases to 81 MB only.
View 6 Replies
Jun 6, 2010
This is my scenario
1: I upload an image
2: Without altering it,I make a copy of it and use it display to users in resized format
note: I won't display the original image.
3:Now when user deletes the resized image,i need to delete the image loaded as bitmap i.e. the original image which i won't be displaying
For that I used bitmap.bitmapData.dispose() method.But,it doesn't free up the memory taken by the bitmap.For instance at initial state the memory usage is 58 Mb and upon loading 3 images the size increases to 87 Mb.And when I delete all the images the size decreases to 81 MB only.I feel the loaded bitmap is not completely removed.
View 9 Replies
Apr 23, 2007
I'm trying to use BitmapData to capture a movieclip that has been created dynamically.
Here's my code:
Code:
on(release)
{
import flash.display.BitmapData;
[Code]....
As u must have noticed, the movieclip i wanna draw, namely _root.VESSEL, itself contains several other clips (eg _root.VESSEL.db). The problem is that the clip doesnt get drawn at all! All i get is a white rectangle of the size i've created the bitmapData. But nothing of that movie clip has been captured.
is it that the BitmapData cannot capture the details of a clip if it has child clips?? Coz here, VESSEL itself was created empty, and all the new shapes are actually being placed as movie clips inside other empty clips that were created in VESSEL.
View 5 Replies
Apr 29, 2009
I have a flash app based off the Screen shot maker found here: [URL]
Creating a screen shot from an flv on the same server works fine, but when I try to load the contentPath from a remote server the video plays fine, but the .jpg generated in the PHP file is blank with a white background.
Here's the ActionScript:
PHP Code:
import flash.display.BitmapData;
vid.contentPath = flvurl;
var vidid = vidid;
[Code]......
View 1 Replies
Jul 15, 2009
I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?
View 2 Replies
Jan 29, 2007
I've started getting to grips with using the BitmapData class and a Transformation Matrix in the hope that I can start making some interesting image effects. However, at the moment Im having trouble figuring out how to shift the newly created bitmap so that any scale transformations are applied from the center rather than the top left corner. See here for example: [URL] The flower on the left is the original, the flower on the right is the new image created using "bitmapData.draw()". It has been scaled up to twice the size, but I want this to happen from the center of the image.
[Code]...
View 5 Replies
Aug 24, 2010
I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.
View 2 Replies
Feb 3, 2009
I'm cutting my teeth in actionscript 3 on a game that has a character running through a world. So, I have set up my Hit Testing by using the bitmap data hit test method, since I figured my world is going to be destructible - it'd be nice to update the level and then redraw it and have the character interact with the new change. (That works beautifully) I am however; a bit confused as to how I have my hit Testing set up. I've been messing around with it, and it works for now - but I'm not sure why.. currently, I have a character set up by using a class I built and using a series of animations I created. So, this character has a walking and falling animation, etc. This is a movie clip.
Then there's a bitmap 'emptyBitmap' with bitmap data created - however; I never really added this as a child to the character. This is sized to the dimensions of my character. My level is created as a movielip, then it's drawn to a bitmap - when the level movieclip is changed, the bitmap redraws, and that's how this updates.
[Code]....
View 1 Replies
Oct 22, 2010
So, you have a sprite, you draw some graphics, you set cacheasbitmap=true... I can't seem to access the newly created bitmap data, to access the dispose() method.
[Code]...
View 6 Replies
Jan 31, 2012
I have a bit trouble with LoaderMax memory occupy, i have a queue, and i am keep loading images depend on user's action. if they click load more and it keep load, but i would like to clean the memory which been occupied by the previous queue (i have remove all the children been added by the loading previously). is there a way i can do it? the behavior like this.
[Code]...
View 1 Replies
Sep 26, 2010
I have an FPS monitor running and notice that I am getting choppiness here and there, bringing my game from 40 to 27 fps and back and forth at certain stages. I have an idea of where it is happening, but do not know for sure. I looked up quite a few memory monitors but haven't found anything decent yet. Is there a memory monitor that allows you to see the memory leaked and find its location? If not, how about just he memory leaked?
View 4 Replies
Feb 15, 2011
There is a Flex app with 7 main views. And there is a memory issue when navigating between views.All these views were in a ViewStack, but due to some involving 3D objects I assumed it was too much to have it all in the display list. I'm now clearing all children from the stack and adding/removing them when needed. This gave a small performance increase, but still becomes unresponsive with use. The strange thing is, with this and the original method, the CPU climbs with use but eventually levels out somewhere. Now I'm creating new instances of each screen when they are navigated to and setting the previous variable to null. Now it looks like CPU is spiking when the view is created, but leveling out to something much much lower than it was. This felt like progress, but now the available memory keeps climbing where it wasn't before....
My understanding was calling remove child or remove all children would mark the object for deletion when the garbage collector next ran. I can't see any other references to the instance. My code is along the lines of [code]I have a function for each button to add a new instance like the above.The only thing I can see and feel silly asking but need confirmation, is each view extends a class called "Screen", this class contains a singleton reference to some core components.[code]Would this trick the garbage collector into thinking it was still needed? General advice on clearing Objects from the memory pool would awesome!!! I've never needed to analyze the Flash Player in such depth.I think it's an error with sound drivers, removing all sound and shes purring like a kitten. Works on my machine fine with windows XP, but not on the touch pad the application is crashing on with windows 7 (unsure of the drivers looking into them now) Now I'm thinking its not the drivers, tried 3 different versions, all with no improvement. I did discover the sound was fading in and out with the TweenLite lib. Doesn't look like there are any memory leaks in TweenLite as it works fine on other machines. Just the use of volumeEasingFunction seems to consume increasing amounts of CPU until it freaks out. It is crappy hardware running windows 7, which doesn't help.
View 1 Replies
Mar 16, 2012
I have a Flex 4.6 web game which displays 2 Lists with virtual layouts with 2 custom item renderers. The renderers consist mainly of BitmapImages displaying user avatars + few Labels.
The Lists are being updated often over TCP socket with gzipped JSON data. I merge that data into 2 ArrayCollections serving as dataProviders for the Lists. This seems to work well, the Lists do not flicker and are updated correctly (I've monitored debug traces a lot to get it right).
[Code]...
View 1 Replies
Jan 31, 2007
I'm using Flash 8, with this code in the first frame:
import flash.display.BitmapData;
rissa._x=Stage.width/2;
rissa._y=Stage.height/2;[code].....
When I publish the file, I'm getting the following error message in the Output panel:
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");
Total ActionScript Errors: 1 Reported Errors: 1
View 8 Replies
Oct 14, 2009
I am trying to use the reflect class from "http://pixelfumes.blogspot.com/2007/03/reflection-class-v3-with-source .html" but I keep getting this error:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at Reflect()
at Site_fla::GalleryPage_29/loadThumbs()
at Site_fla::GalleryPage_29/sortXML()
[Code]...
btw, first I used assigned thumbContainer as the mc argument (outside the loadThumbs() function) and it worked but not exactly what I wanted... because I thought it is supposed to update when the movieclip is animated but it actually didn't... when I use a scroller, only the thumbs that are first loaded to the stage get the reflection..
View 10 Replies
Dec 29, 2011
I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.
View 3 Replies
Sep 1, 2011
how to use the bitmapData collision method. Now I'm trying to figure out if there is a way to see at what angle or coordinate of the bitmapData the collision happens? I need it in order to figure the accurate bounce angle after the collision occurs.
View 2 Replies
Aug 2, 2007
I'm making an isometric game and I need to know which takes less memory for scrolling, making everything invisible that you can't see? Like if(!this.base.hitTest(worldHitter))this._visible = false; Or would it be better to remove the movieclips unseen and then reattach them when i should see them?
View 2 Replies
Feb 2, 2010
I have built an image cache which is an ArrayCollection containing images. I have built functionality so that the cache can hold a max of 250 images. However, the images can be of a different size, so it's better to limit the total memory size of all images in the ArrayCollection. How I can get the total memory size of an ArrayCollection without looping through all the items in the ArrayCollection?
View 1 Replies
Mar 4, 2011
System.totalMemory gives the total memory used by the flash player and not one particular application. Is there any way I can get the flex application's memory usage in code/actionscript?
View 3 Replies
Jun 29, 2009
Loading images into Flex (size < 100kb) causes IE7 memory increase by a megabyte per image. What's going on here? Here is the code I have -- this for each image:
[Code]...
View 3 Replies
Jul 20, 2009
I have an AIR/Flex app I made, I have a few people testing it and everyone is reporting that after leaving it running for a while, it is making all there machines run very slow. It runs fine at first so this must be a memory leak somewhere. I used the profiler on this and the only thing that shows as using a substantial amount of memory is MethodQueueElement which is not a class I wrote, and I have no idea what it does, I am assuming its part of the Flex framework. I am not familiar with using a profiler so I am not sure what all I shuld be looking at, that was the only class that was high on "memory" and it said it had over 100,000 instances. If this is my problem what can I do to fix it?
View 1 Replies
Nov 10, 2009
I was recently profiling my application that uses Degrafa States in the skins and noticed that doing so uses more memory than I expected. Between the SetProperty and State, they were using about 10% of the total used application memory.
Would it be better to use css for the state changes and a new skin for each state? or Are there some simple tips to reducing the memory footprint of degrafa?
View 1 Replies
Feb 4, 2010
Does creating a lot of private variables that may never be used increase file size and or memory usage of your application?
View 2 Replies
Feb 11, 2010
How do you know if your compiled SWF file has a memory leak?
Are there tools, a firebug setting, etc... to see if there is a problem? I cannot find much in the debug Flash player besides file size and loading time.
I have a large Flash application that I maintain and suspect that is using way too much memory so I wanted to measure the amount of RAM being used while it executes to find key areas to optimize.
View 3 Replies
Jun 11, 2010
I am working on a modularized Flex application, and I am trying to cut-down on the amount of client-server interaction.Every time a module is opened, a request is made to a web service to get values to bind to the Flex form. If a user closes the module, and then reopens it at another time during their session, the same web request will be made.Since this data is static, i.e. not changing, I am thinking about creating global variables to hold the data providers. On the initial application load, a series of web service calls will be made to fill all needed data providers. Then, any time a module is opened, it can use these global providers instead of making unnecessary and repeated requests. These are NOT going to be huge providers, so I don't think browser memory should be a concern.
View 1 Replies