Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / My app uses 176 Mbs of RAM?!?!?

Author
Message
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Apr 2013 03:57 Edited at: 30th Apr 2013 03:59
Doge those Balls loads around 15 Mb's of media (mostly .png images) but uses 176 Mb's of RAM, why is this happening?
is it possible because of the size of some of them, does AppGameKit uncompress image totally? for instance, there is a set of 27 images to be loaded, each with a res of 320x476, the total size of the .png's is just over 1 Mb, but this loads around 30Mb's in AGK.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Apr 2013 04:06
What device (Windows, iOS or Android) are you seeing this on?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Apr 2013 04:13
Windows, it's a t1 app using AppGameKit version 1.08.11
it plays fine on Android, but it may have large memory usage anyway (I haven't checked)

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 30th Apr 2013 04:23 Edited at: 30th Apr 2013 04:23
That does seem unusual. My biggest application to date only consumes 75 MB in Windows (using Beta 11) and that's with 15-20 MB of media and some large sprite sheets.

It may be tricky to diagnose without knowing how it was coded. How much does a blank AppGameKit application consume on your computer? With the default Hello World app the AppGameKit Player takes up 25 MB itself.
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Apr 2013 04:53 Edited at: 30th Apr 2013 06:19
the default landscape project takes 28.8 Mb's on my computer
another project of mine that loads around 10 Mb's of file takes 110 Mb's of RAM
I also tried compiling it (Dodge those Balls) with 1076 and it still takes 173.4 Mb's
I've attached another project (including source code) of mine that I stopped working on, it loads less than 1 Mb of files, but takes 35.8 Mb's of RAM on my computer (Windows 8)

here are samples of the code:
main.agc


[init.agc]



edit: file is now attached

Attachments

Login to view attachments
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Apr 2013 06:00
PNG does compress the image data. Gotta consider that it's not compressed once in memory. Still, that does seem a lot higher than I would expect.

My current project consists of 1.5MB of media(including bytecode) plus 1.8MB for the executable. In RAM it registers at less than 29MB.

Quote: "but takes 35.8 Mb's of RAM on my computer (Windows 8)
I also tried compiling it (Dodge those Balls) with 1076 and it still takes 173.4 Mb's"

I ran your project, it uses less than 28mb on my computer.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Apr 2013 06:33
I've attached a tiny project that loads a 1.89 Kb image 1000 times, this project uses 118.8 Mb of RAM on my computer, it should technically use around 30 Mb's (25 for Default and 5 for images)

Attachments

Login to view attachments
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 30th Apr 2013 08:01
I tested the last version of your game that you posted for PC on both Windows 7 and Windows 8 (64-bit each). It definitely appears that Windows 8 nearly doubles the RAM consumption compared to Windows 7.


Windows 7 reports 51 MB
Windows 8 reports 92 MB

I also tested the demo you posted:

Windows 7 reports 23 MB before the load, 73 MB after the load.
Windows 8 reports 32 MB before the load, 120 MB after the load.

But I see what you mean about the seemingly excessive file size in either case. Hmm...
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Apr 2013 08:17
looks like TGC might need to do some optimizing
unfortunately this large RAM usage seems as if it's making DtB crash on iPod Touch.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Apr 2013 11:11
strange, what happes if you exchange the loadimage (and similar the deleteimage)
global imagesum
function LoadImageEx(file$)
img=Loadimage(file$)
x=getimagewidth(img)
y=getimageheight(img)
imagesum=(x*y*4)/1024/1024

endfunction img
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Apr 2013 14:43 Edited at: 30th Apr 2013 14:45
Sounds like Windows 8 does something pretty inefficient itself.

You forgot to add in the 12 byte header

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Apr 2013 17:38 Edited at: 30th Apr 2013 17:44
maybe there is a image that can\'t be read correct.
are all images from you, or did you use/copy old images from hd?
what happens if you use all as png.


I also tested the demo you posted with 1000x images:
Windows 8 reports 28,2 MB before the load, 73,9 MB after the load.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Apr 2013 19:11
Weird... I use all PNG files and my most recent build in 10811 uses 65MB of memory in Win7 64bit. The total size of all of the assets is 12MB.
The Bunnies game takes about 50MB of RAM on my PC.
This is pretty normal. I don't see many games take less than 40MB.

I just tested DtB on my HTC Dinc2.
If I look at it in a memory usage app then it says 43MB to 181MB...
On my Nexus 7 it says 43-63MB.

On Nexus 7 - dFenz is using 53-79MB.
On HTC Dinc2 - dFenz is using 49-89MB.

dFenz only uses collision boxes for any physics and no particles.

With DtB I do notice some big lag when loading and whenever achievements pop up. These we not so noticeable before.
It is pretty weird that DtB takes up so much more memory on the Dinc2 while dFenz is relatively stable.

Are you accidentally loading the image every time you make a sprite?
I ran into some issues with dFenz because I was updating collision boxes on every loop.
Do you delete your intro images after they're shown? The only other thing I can think of is to size your images/textures in a size of power 2 (i.e. 256, 512, 1024, etc). This may significantly help on some devices.

It sounds to me as if AppGameKit is just not handling resources properly on some devices. This could be an issue. I've not heard an complaints yet about dFenz on iOS, so I'm thinking you have somewhere in DtB that you can make an improvement.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 30th Apr 2013 19:43
Could it be different ways of handling video memory?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 1st May 2013 03:20
If that were the case then you'd think that dFenz would take up a lot more memory on the dinc2 just like DtB does, but it doesn't.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 1st May 2013 04:16
Paul posted this in the AppGameKit 10811 thread:

Quote: "I recently found a crash on the iPad 1 with one of our apps because it was running out of memory. It only had 256MB of RAM and the images we were loading took up about 60MB uncompressed by themselves, after the app got to about 115MB in total it got force closed. The iPod 4th gen also only has 256MB of RAM so it could be the loaded images taking up too much space. The next beta will have code that detects these two devices and if you have used SetIntendedDeviceSize(1024,768) will assume these are low res devices and scale the images down."


iPod touch also only has 256MB of RAM
Maybe once the next AppGameKit update is out you'll be able to us SetIntendedDeviceSize to help adjust. You could probably use it now after using GetDeviceHeight/Width.

I find it hilarious that Apple is ripping people off so much.

easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 1st May 2013 05:35
That makes sense, DtB is crashing is iPod Touch's, which is a big problem.

Login to post a reply

Server time is: 2024-05-03 20:44:25
Your offset time is: 2024-05-03 20:44:25