Memory Management

Discussion and feedback on Construct 2

Post » Wed Feb 29, 2012 8:51 pm

Hi,

I like to know if somebody knows what is best, in memory management terms, in this two situations:

- a project with two "layouts", A and B, when you go from A to B the "sprite images" of A are discarded from memory and the "sprite images" of B are loaded.

- a project with a single "layout" and two Layers, A and B, when you do a command the "Layer A" opacity are set to 0 and the "Layer B" opacity are set to 100, but I think than all the images stay loaded in memory.

I need to evaluate this for continue in a mobile project.

P.S: I will use the Safari browser of iPad to acess the app.

Thanks
B
90
S
5
G
8
Posts: 165
Reputation: 7,648

Post » Wed Feb 29, 2012 9:07 pm

I believe both solutions are the same at the moment.

Images are loaded in VRAM on loading/downloading of the game/application and decompressed there.
All the images of all your project are loaded there at first.

Destroying instances between a layout to another has no effect on the VRAM usage, the decompressed textures stay there.
(source: blog article about C2's image compression)

Ashley said he would add a feature to load up image per layout, on start of the layout at some point (no ETA on this feature though).
When this feature will be available, than your idea of "discarding" textures to only have the current layout's textures in VRAM will be the correct way to go I believe.

In the meantime, not much to do unless keeping the number of textures of your whole project the lowest possible to stick/match with the available VRAM on the device.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Feb 29, 2012 9:20 pm

Thanks Kyatric,
Your attention is always helpfull.

By the way do you know how to measure the total VRAM I am using in a project? And what is the total amount of VRAM in iPads?
B
90
S
5
G
8
Posts: 165
Reputation: 7,648

Post » Wed Feb 29, 2012 9:46 pm

Those are good question I'm afraid I can't give a definite answer for.
I don't have any smartphone/tablet.

On my desktop computer, I do have some widget on the desktop that allows me to keep an eye on the performances of my nvidia graphic card, giving me the amount of VRAM used/available, usage percentage, etc...

I bet there are some apps available for your device that would provie the same service hopefully, but I have no link to give you.

Maybe other mobile-users will have an answer for you.
For now all I could advise you would be to try to find such an app in the appstore of your device and/or google about this specific device in case you would find the specs on a blog or a review website.Kyatric2012-02-29 21:47:11
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Feb 29, 2012 10:03 pm

[QUOTE=Kyatric] On my desktop computer, I do have some widget on the desktop that allows me to keep an eye on the performances of my nvidia graphic card, giving me the amount of VRAM used/available, usage percentage, etc...[/QUOTE]

Could you share a link?

Edit: To the widget, not your desktop ;)shinkan2012-02-29 22:04:16
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Wed Feb 29, 2012 10:11 pm

@shinkan: I'm using the "All CPU meter", "Network Meter" and "GPU Meter" from http://addgadget.com/.
Dual screen ftw, they all stand on top of each other ^^

Kyatric2012-02-29 22:11:38
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Feb 29, 2012 10:18 pm

haha, thanks @Kyatric
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Wed Feb 29, 2012 10:44 pm

Thank again Kyatric,

I will look for yours suggestions
B
90
S
5
G
8
Posts: 165
Reputation: 7,648

Post » Thu Mar 01, 2012 12:34 am

I don't know enough yet about Construct to comment on this for sure (still really new to Construct), but if I had to guess, I'd think that option 1 would be slightly better. I say this because I would *guess* that Construct does not create all objects in memory from all layouts at the start. Therefore you have fewer objects in memory at a time by splitting into separate layouts. If you have both layers in one layout, all of the objects in both layers are in memory at the same time.

Also there would likely be a CPU advantage to option 1.

Like I said, I don't know the inner workings of Construct yet, and the difference is likely to be small from a memory standpoint anyway, but that is what I would think...

Also it depends on the situation of course. If it is important that there be minimal delay when "switching," layers would be the way to go.unlikely2012-03-01 00:38:52
B
13
S
6
G
2
Posts: 13
Reputation: 1,977


Return to Construct 2 General

Who is online

Users browsing this forum: bilgekaan, Davioware and 2 guests