Question

Doc says:

Starting with AIR 3 and Flash player 11, the size limits for a BitmapData object have been removed. The maximum size of a bitmap is now dependent on the operating system.

But, why can't I have 120,000 x 120,000 px BitmapData object? I'm on OS X Lion with 64 bit kernel.

Now 120,000 ^ 2 would give me 14,400,000,000 pixels I need to occupy, which takes only 34 bits to store that int. But apparently I can have 64 bit integers, no? Do I miss something? And what does it mean "dependent on the operating system"? How?

Was it helpful?

Solution

Since when is a BitmapData pixel equivalent to a single bit? Remember that you are dealing with color information, so each pixel occupies at least a uint(=> size:32 bits, or 4 Bytes).

Which, then, means that your memory consumption is actually

120000^2 * 4 => 57,600,000,000 Bytes => ap. 53,6 GB

Also note that while Number is a 64-bit data type, int and uint are not.

You might want to consider using a different means of organizing your data.
If you are dealing with a large picture, you have to split it up into parts of reasonable size. The limits may have been lifted, but I would recommend you restrain yourself to max. 4 times the stage size (that's small enough for reasonably smooth scrolling, and large enough so you don't have to place objects on the stage all the time).

If it is not actual pixel information you want to store, perhaps ByteArray could be a possible alternative.

OTHER TIPS

Actually, there're several software and hardware limitations for amount of addressable size. Except 32/64 bit architecture, there're several others:

  • memory controller total limit
  • amount of RAM slots x MAX RAM module size
  • some memory management layer implementations like PAE (depends on CPU + OS) may even increase amount of total addressable virtual memory, but max.amount of physical memory remains the same.
  • marketing/software OS limitations (see section 2.5 for windows versions in the same wiki article);

The only info I've found on web states, Mac OS X Lion (not Server) has software limit of 64GB. The try of allocating more memory in one piece, than machine physically has hardly would be succeeded, though.

What kind of stuff do you want to save? Something generatively? I think you need to create a system where you use a fixed random seed, and build something view/create at low-res. You should be able to repeat the same motion. You probably have to save the (custom) motion to get to that point in a way too. If you have that you should apply a scale variable and render tile per tile to get around a big-ass canvas. This kind of system takes time to build and could still give some problems if the stuff that should be drawed is scaled too high.
As stated, for that kind of prints you don't need that high resolutions. Ofcourse beside that, it would be a challenge anyway to get those huge sizes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top