и очищаю... а память всеравно растет
Знакомый попробывал скомпилировать у себя на Flash CS3 у него работает немного по другому, память увеличиваеться до определенного момента, а потом очищаеться, я компилировал на Flash CS5 у меня не очищаеться... бред какой-то...

Код AS3:
package app
{
import flash.system.Security;
import flash.system.System;
import flash.display.*;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.*;
import flash.filters.ColorMatrixFilter;
import flash.geom.Point;
public class MemoryTest extends Sprite
{
protected var _leftBitmap:Bitmap;
protected var _rightBitmap:Bitmap;
protected var _convertedBitmap:Bitmap;
protected var _memoryInfo:TextField;
protected var _leftBitmapMatrix:Array;
protected var _rightBitmapMatrix:Array;
protected var _testFilter:*;
public function MemoryTest()
{
_leftBitmap = getBitmap(LeftImage);
_rightBitmap = getBitmap(RightImage);
_memoryInfo = new TextField();
stage.addChild(_memoryInfo);
_leftBitmapMatrix = new Array();
_leftBitmapMatrix = _leftBitmapMatrix.concat([0.299, 0.587, 0.114, 0, 0]); // red
_leftBitmapMatrix = _leftBitmapMatrix.concat([0, 0, 0, 0, 0]); // green
_leftBitmapMatrix = _leftBitmapMatrix.concat([0, 0, 0, 0, 0]); // blue
_leftBitmapMatrix = _leftBitmapMatrix.concat([0, 0, 0, 1, 0]); // alpha
_rightBitmapMatrix = new Array();
_rightBitmapMatrix = _rightBitmapMatrix.concat([0, 0, 0, 0, 0]); // red
_rightBitmapMatrix = _rightBitmapMatrix.concat([0, 1, 0, 0, 0]); // green
_rightBitmapMatrix = _rightBitmapMatrix.concat([0, 0, 1, 0, 0]); // blue
_rightBitmapMatrix = _rightBitmapMatrix.concat([0, 0, 0, 1, 0]); // alpha
stage.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler);
applyFilter(_leftBitmap,new ColorMatrixFilter(_leftBitmapMatrix));
applyFilter(_rightBitmap,new ColorMatrixFilter(_rightBitmapMatrix));
}
protected function getBitmap(src:Class)
{
var image = new src();
var bd = new BitmapData(image.width,image.height);
bd.draw(image);
var bm = new Bitmap(bd);
return bm;
}
protected function mouseDownHandler(evt:MouseEvent=null)
{
if (_convertedBitmap)
{
clearBitmap(_convertedBitmap);
_convertedBitmap.parent.removeChild(_convertedBitmap);
}
_memoryInfo.text = "Memory: "+System.totalMemory/(1024);
_memoryInfo.autoSize = "left";
_convertedBitmap = new Bitmap(new BitmapData (_leftBitmap.width, _leftBitmap.height, true, 0));
_convertedBitmap.bitmapData.draw(_leftBitmap, null, null, BlendMode.ADD);
_convertedBitmap.bitmapData.draw(_rightBitmap, null, null, BlendMode.ADD);
addChild(_convertedBitmap);
}
protected function clearBitmap(bitmap:Bitmap)
{
if (bitmap.bitmapData)
{
bitmap.bitmapData.dispose();
bitmap.filters = [];
bitmap.bitmapData = null;
bitmap = null;
}
}
protected function applyFilter(bitmap:Bitmap,colorMatrixFilter:*)
{
var filters:Array = new Array();
filters.push(colorMatrixFilter);
bitmap.filters = filters;
}
protected function getProccessedBitmap(srcBitmap:Bitmap,filter:*)
{
var proccessedBitmapData = srcBitmap.bitmapData.clone();
var proccessedBitmap = new Bitmap(proccessedBitmapData);
applyFilter(proccessedBitmap,filter);
return proccessedBitmap;
}
}
}