joboldo

Hi,

we made some tests with the binary format and the memory usage on iOS is crazy.

Here is our Memory usage test on iOS with Instruments:

When we load scene0 (with no animations) the Memory usage is around 66MB -> switching to the new Scene with only 1 Spine Animation (binary format and a 4MB texture) the usage is going up to 77 MB.

Can somebody help please. We have a release coming up and using a lot of animations(binary format) and the Memory usage is just too high.

Thanks.

---

Update: Made the same test with json-Format and the Memory Usage goes also from 66 MB -> 77 MB. Why is it using so much Memory? This animation-file has 12 different animations, uses a 4MB texture and the skeleton file is 90KB big. Shouldn't consume over 10 MB Memory, right ?

The problem is that we have a couple of different characters and the Memory usage in our app is over 250 MB ( a scene with only the animations in it). Can somebody help and take a look. Thanks a lot.
joboldo
  • Messaggi: 17

Mitch

is your 4MB Texture marked as isReadable ? Cuz that'll do it.
Also is your 4MB texture Compressed or True Color?

TL;DR though this has very little to do with Spine. Your skeleton data is not eating the difference in that memory.
Avatar utente
Mitch

Mitch
  • Messaggi: 978

joboldo

thanks for the reply.

The texture is not marked as isReadable and its True Color.

Why does it consume over 10 MB Memory? Can I send you one animation and you can take a look? That would be very helpful. Thank you
joboldo
  • Messaggi: 17

Mitch

Start by putting your 4mb texture on a standard unity quad and putting in your scene close to the camera (to rule out mipmaps). See if you get a 10-ish-mb increase.
Avatar utente
Mitch

Mitch
  • Messaggi: 978

joboldo

ok i did that. Here is my result (using an iPhone 6, Memory Usage measured in Instruments):

Empty scene is around: 64 MB.
Empty Scene with 1 spine-character(4MB texture) is around: 78 MB.
Empty Scene with standard unity quad with only Spine-Texture on it is around: 69 MB

So there is clearly some big memory overhead using spine animations. This is a serious problem in our app. We cant release our app (with a couple of spine characters) because it uses too much memory on iOS devices.

Please help us out and take a look on that problem. I can provide some test animations. Please get in touch.
joboldo
  • Messaggi: 17

Pharan

Have you tried calling GC.Collect() after the load phase?
Just a hunch.
Avatar utente
Pharan
  • Messaggi: 5366

joboldo

Yes we tried that, doesn't help :( Any other suggestions?
joboldo
  • Messaggi: 17

Nate

Sorry, Mitch doesn't have a great setup for iOS development at the moment. Can you use profiling tools and dig deeper to find where the memory is going?
Avatar utente
Nate

Nate
  • Messaggi: 12016

Mitch

https://github.com/EsotericSoftware/spine-runtimes/commit/83624a2259698b39ce1feaf102e0f4c8cfe362b5

Roll back to this commit and try it if you can :/ We recently merged a giant pile of efficiency improvements and I haven't had time to benchmark them properly. See if this pre-merge commit (it should be fully compatible w/ whatever you have now if you're on latest) resolves the memory issue. Sorry I'm not setup to do iOS dev at the moment.

---

Adding to this... try enabling assembly stripping. iOS is notoriously bad at generating overhead with IL2CPP. Honestly it might simply be the current cost of using Unity5's compiler w/ whatever XCode is doing to it... I don't think Spine has as much overhead as you reported.
Avatar utente
Mitch

Mitch
  • Messaggi: 978

joboldo

we tried your suggestions but nothings helps... the RAM is increasing by 10 MB for 1 character.

In addition to that big memory usage we discovered a memory leak. When we switch from the character scene into an empty scene the memory will first be unloaded after 30-40 seconds.

We tried to narrow down the problem and it seems while parsing the skeleton data the big float arrays (like timelines) will blow up the memory.
joboldo
  • Messaggi: 17

Mitch

We tried to narrow down the problem and it seems while parsing the skeleton data the big float arrays (like timelines) will blow up the memory.
Does this occur with JSON as well?
Avatar utente
Mitch

Mitch
  • Messaggi: 978

joboldo

yes its even higher with JSON
joboldo
  • Messaggi: 17

Pharan

Thanks, IL2CPP.

Just to be sure:
Your build settings aren't contributing to it, right?
No debugger stuff from Xcode or Unity that could cause float arrays (or whatever else it really is) to act like that?

Sorry, I don't have an iOS setup either.
Avatar utente
Pharan
  • Messaggi: 5366

joboldo

we are testing with a release build (no debug stuff) ... we think it has something to do with the big float arrays while parsing the skeleton data. Objects greater than 80 KB are treated as large objects by the garbage collector and are directly allocated in a special heap. We think Unitys Garbage Collector doesn't clean up these objects right.

This is a serious problem when you have a game with a lot of animations.

Lets solve this problem together.

Is there a possibility that the Spine Support team could get a iOS setup to help the spine users? That would be helpful.
joboldo
  • Messaggi: 17

Pharan

I think the way to get Unity Support to help us is if we manage to reproduce the problem in the smallest and simplest possible project, and file that bug.
Avatar utente
Pharan
  • Messaggi: 5366

ZimM

Have you tried switching to Mono runtime, just to see if the problem exists there too?
Avatar utente
ZimM
  • Messaggi: 25

Pharan

You can do that for iOS?
Avatar utente
Pharan
  • Messaggi: 5366

ZimM

Pharan ha scritto:You can do that for iOS?
Yep, you can select the runtime - Mono or IL2CPP. You won't be able to publish the game built with Mono in App Store since there's no 64-bit support, but you don't need that for testing purposes.
Avatar utente
ZimM
  • Messaggi: 25

Mitch

ZimM ha scritto:
Pharan ha scritto:You can do that for iOS?
Yep, you can select the runtime - Mono or IL2CPP. You won't be able to publish the game built with Mono in App Store since there's no 64-bit support, but you don't need that for testing purposes.
Glad to have you on this :angel:

I'm way too busy on contract work atm.
Avatar utente
Mitch

Mitch
  • Messaggi: 978


Torna a Unity