playMaker

Author Topic: [SOLVED] Insane 0.6 GB memory allocation on iOS app - reasons?  (Read 5835 times)

photonic

  • Playmaker Newbie
  • *
  • Posts: 4
Hi there,
I am experiencing above total memory allocation although the profiler shows me only,

26 MB texture memory (using NGUI atlases and some compressed textures)
17 draw calls
180 MB audio memory (I need wav-files streaming from disk)

Can it be that multiple ArrayLists and HashTables (referencing gameobjects) are the reason for this?

I am kind of devastated and would appreciate any help.
Thanks a lot!
« Last Edit: April 21, 2014, 10:43:06 AM by photonic »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #1 on: April 08, 2014, 07:16:33 AM »
Hi,

 you need to profile it to know exactly where the memory leak is.

 Do you load scenes in and out? that could be the problem.

Bye,

 Jean

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #2 on: April 08, 2014, 08:52:53 AM »
Is this immediate or does the memory slowly climb. If the latter it is most likely a memory leak.

photonic

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #3 on: April 08, 2014, 09:37:44 AM »
the memory allocation is up to 0.57 right from the start and creeps its way further during runtime.

I turned off all FSM suspecting Arraylists and Hashtable generation. .. didn't help

 :'(

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #4 on: April 08, 2014, 02:20:07 PM »
Disable one thing at a time until you find it, fun stuff eh.

photonic

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #5 on: April 08, 2014, 03:00:41 PM »
[UPDATE]
Ok, now it's obvious that using wav-files and "streaming from disc" allocates this big chunk of memory ...
What can I do if I need the original wav-length in order to jump to specific sample-positions?

thanks a lot!

 

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #6 on: April 08, 2014, 10:07:12 PM »
I always get annoyed when people ask questions instead of answering, but with that said.

Why do you need them to be wav files? Wouldnt something a little smaller do? Are these always the same files or are you getting them off the users device? If they are always the same files just read the lengths in a post process script and save it to a file or something.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #7 on: April 09, 2014, 12:11:12 AM »
Hi,

 I have IOS projects with lots of videos and it's fine, I think your problem is the following:

 are you referencing the file directly? if you do, then it has to be loaded in memory. The key is to NOT point to it directly and simply use a string as the path and let Unity find it on its own.

You'll need to load these resources at runtime, ONLY when needed.


 Bye,

 Jean

photonic

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #8 on: April 21, 2014, 10:38:28 AM »
Hi Jean,

thanks for your reply.

I used a String Compare to enter two different State Machines depending on the chosen language. There I set an audioClip-variable referencing the appropriate audio files directly. Then I switched the audioClip of my single audioSource as needed, using the mentioned audioClip-variables.

Funny workaround was: I created an empty gameObject with its own audioSource for every audioFile I would need (=4 + 1 soundtrack) and this astonishingly reduced the allocated memory by 250MB ... crazy ;-)

Got my app out to the App Store just in time :-)
... will tweak that subject further ...

Thanks a lot for your suggestions

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED] Insane 0.6 GB memory allocation on iOS app - reasons?
« Reply #9 on: April 30, 2014, 03:34:53 AM »
Hi,

 Very godd. Thanks for the update.

bye,

 Jean