WAZUMBi Well-Known Member Licensed User Longtime User Jun 26, 2012 #1 If I have, say 20+, image views and load them all with the same bitmap does each one make a copy of the image in memory or do the imageviews simply point to the same bitmap image. In other words is: dim imv(20) as imageview for i = 0 to 19 imv(i).bitmap = LoadBitmap(File.DirAssets, "image.png")next less efficient than: dim bmp as bitmap dim imv(20) as imageview bmp.Initialize(File.DirAssets, "image.png") for i = 0 to 19 imv(i).bitmap = bmpnext
If I have, say 20+, image views and load them all with the same bitmap does each one make a copy of the image in memory or do the imageviews simply point to the same bitmap image. In other words is: dim imv(20) as imageview for i = 0 to 19 imv(i).bitmap = LoadBitmap(File.DirAssets, "image.png")next less efficient than: dim bmp as bitmap dim imv(20) as imageview bmp.Initialize(File.DirAssets, "image.png") for i = 0 to 19 imv(i).bitmap = bmpnext
NJDude Expert Licensed User Longtime User Jun 26, 2012 #2 Doing it any of those 2 ways you might get into out of memory errors, it will be better to load them as you need them. Last edited: Jun 26, 2012 Upvote 0
Doing it any of those 2 ways you might get into out of memory errors, it will be better to load them as you need them.
WAZUMBi Well-Known Member Licensed User Longtime User Jun 26, 2012 #3 For animating characters or objects in simple 2d games for example you may have 10, 20, or more images displayed at a time. Many of the same image which are usually pretty small (<50kb). In my nonogram app for example to there can be upto 1440 images for the largest grid but they all point to a maximum of 16 different images all less than 1kb. There doesn't appear to be a performance hit unless I load an image for each separately even though they will never user more than 1.5mb of memory. If I have the images point to bitmaps already in memory then no problems. It would appear that I answered my own question. Upvote 0
For animating characters or objects in simple 2d games for example you may have 10, 20, or more images displayed at a time. Many of the same image which are usually pretty small (<50kb). In my nonogram app for example to there can be upto 1440 images for the largest grid but they all point to a maximum of 16 different images all less than 1kb. There doesn't appear to be a performance hit unless I load an image for each separately even though they will never user more than 1.5mb of memory. If I have the images point to bitmaps already in memory then no problems. It would appear that I answered my own question.
thedesolatesoul Expert Licensed User Longtime User Jun 26, 2012 #4 WAZUMBi said: For animating characters or objects in simple 2d games for example you may have 10, 20, or more images displayed at a time. Many of the same image which are usually pretty small (<50kb). In my nonogram app for example to there can be upto 1440 images for the largest grid but they all point to a maximum of 16 different images all less than 1kb. Click to expand... Remember to calculate the 'uncompressed' size because that is what is stored in memory. If I have the images point to bitmaps already in memory then no problems. It would appear that I answered my own question. Click to expand... Once you load a bitmap in memory, other variables will just store a reference to it. Upvote 0
WAZUMBi said: For animating characters or objects in simple 2d games for example you may have 10, 20, or more images displayed at a time. Many of the same image which are usually pretty small (<50kb). In my nonogram app for example to there can be upto 1440 images for the largest grid but they all point to a maximum of 16 different images all less than 1kb. Click to expand... Remember to calculate the 'uncompressed' size because that is what is stored in memory. If I have the images point to bitmaps already in memory then no problems. It would appear that I answered my own question. Click to expand... Once you load a bitmap in memory, other variables will just store a reference to it.