How do I reduce memory use?

Get help using Construct 2

Post » Fri Sep 04, 2015 2:51 pm

I am making a project with the total size for the assets 5.9 mb with 14 lines of events. The problem is the memory use says 341.1 mb. How could the memory use be that big? And how to reduce it?
Thanks
B
57
S
13
G
5
Posts: 101
Reputation: 7,522

Post » Fri Sep 04, 2015 2:53 pm

It sounds like it could be the images you're using. Try converting to .png, compressing and reducing size as much as possible.
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 5:10 pm

Frostein wrote:It sounds like it could be the images you're using. Try converting to .png, compressing and reducing size as much as possible.

Thanks @Frostein. I have done that by using Pngoo to compress all the images (in png format. Thats whay the total size of my assets (images and sounds) is 5.9mb. Is it too big? Thanks
B
57
S
13
G
5
Posts: 101
Reputation: 7,522

Post » Fri Sep 04, 2015 5:23 pm

Sound pretty small, maybe you have lots of sprites spawn? or lots of physics / objects / collisions at the same time?

run debugger and see where the memory goes
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Sat Sep 05, 2015 7:48 am

I ran the debugger, and it shows 288 mb for the images. I dont really get it, how can a 5mb images becomes 288 mb? Thanks for the help
B
57
S
13
G
5
Posts: 101
Reputation: 7,522

Post » Sat Sep 05, 2015 7:56 am

Here is a quote from Ashley regarding image sizes:

Some people struggle with memory usage on mobile devices with Construct 2, but usually from lack of awareness to how images are stored in memory. Your game might be a 5mb download since all the images are compressed as PNG or JPEG, but they are extracted to uncompressed (basically BMP) in memory for rendering, which can easily make it 5-10x bigger in memory than the download size. Because lots of people ran in to this we recently added a memory usage tracker in the Construct 2 status bar. It's just an estimate, but will give you a useful approximate figure (e.g. 5mb download size, 40mb memory use).


Source is Here.

In other words, compressing them is pointless, as they are uncompressed in memory.

More useful info can be found in Ashley's latest blog:
Understanding CPU and memory measurements.


What are your image sizes (largest)?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,375
Reputation: 58,432

Post » Sun Sep 06, 2015 1:50 pm

zenox98 wrote:Here is a quote from Ashley regarding image sizes:

Some people struggle with memory usage on mobile devices with Construct 2, but usually from lack of awareness to how images are stored in memory. Your game might be a 5mb download since all the images are compressed as PNG or JPEG, but they are extracted to uncompressed (basically BMP) in memory for rendering, which can easily make it 5-10x bigger in memory than the download size. Because lots of people ran in to this we recently added a memory usage tracker in the Construct 2 status bar. It's just an estimate, but will give you a useful approximate figure (e.g. 5mb download size, 40mb memory use).


Source is Here.

In other words, compressing them is pointless, as they are uncompressed in memory.

More useful info can be found in Ashley's latest blog:
Understanding CPU and memory measurements.


What are your image sizes (largest)?


Thanks a lot @zenox98, all my questions have been answered. I learned many things also regarding memory use.
And for your question, the largest image in my game is 400x320 pixels (8kb).
There are 10 objects with 4 animations each. Each animation has 7 frames with that size of image. I put them all in a single layout.
Thanks.
B
57
S
13
G
5
Posts: 101
Reputation: 7,522


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, David181, fens and 13 guests