Author Topic: NGUI Out of Memory  (Read 4622 times)

ghoulfool

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
NGUI Out of Memory
« on: February 14, 2014, 09:29:07 AM »
Hi! I was working on a Unity scene last night and when I booted up the scene this morning I get an OutOfMemoryException error:

  1. OutOfMemoryException: Out of memory
  2. BetterList`1[UnityEngine.Vector3].AllocateMore () (at Assets/NGUI/Scripts/Internal/BetterList.cs:165)
  3. BetterList`1[UnityEngine.Vector3].Add (Vector3 item) (at Assets/NGUI/Scripts/Internal/BetterList.cs:207)
  4. UISprite.TiledFill (.BetterList`1 verts, .BetterList`1 uvs, .BetterList`1 cols) (at Assets/NGUI/Scripts/UI/UISprite.cs:731)
  5. UISprite.OnFill (.BetterList`1 verts, .BetterList`1 uvs, .BetterList`1 cols) (at Assets/NGUI/Scripts/UI/UISprite.cs:514)
  6. UIWidget.UpdateGeometry (Int32 frame) (at Assets/NGUI/Scripts/Internal/UIWidget.cs:1323)
  7. UIPanel.UpdateWidgets () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1276)
  8. UIPanel.UpdateSelf () (at Assets/NGUI/Scripts/UI/UIPanel.cs:948)
  9. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:907)
  10.  

The scene was fine previously and I've not added any new objects or textures so am a little confused as to what could have caused this.   :o
I suspect be a tiled sprite with UIStretch attached. As deleting that turns the scene from wireframe to textured. Any general pointers to clean up this mess? Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Out of Memory
« Reply #1 on: February 15, 2014, 01:03:56 AM »
Looks like it, yes. Your tiled sprite seems to be so small that it results in way too many vertices. What version of NGUI is this in and how can I reproduce it?

ghoulfool

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: NGUI Out of Memory
« Reply #2 on: February 17, 2014, 09:17:00 AM »
I honestly, am not sure how to go about a repo in this case. The background texture is 10 x 320 for 480 x 320 and 20 x 640 for 960 x 640 screens (multi res atlas). which shouldn't be to many polys (32 x 4 =128 triangles) That might be too small a texture and too many polys, but I'm not doing any optimization at the moment.

Initially I didn't have a problem, but as I was working on the project adding other things to the project, it just got a to a point where it wasn't happy with the background and was barking memory errors. I have since then removed the background and started a duplicate of the project which seems to ok, for the minute.

I can send you the files privately if you want to have a further look.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Out of Memory
« Reply #3 on: February 17, 2014, 12:04:40 PM »
If it's a small project using the latest version of NGUI, I can have a look, but the bigger the project the less likely it is to be useful in determining the cause.

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: NGUI Out of Memory
« Reply #4 on: February 21, 2014, 05:12:34 AM »
Did you find this ?

We have the same issue with 3.4.9. (Think is probably a small sprite being tiled using anchors to make a full screen background)

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: NGUI Out of Memory
« Reply #5 on: February 21, 2014, 05:22:57 AM »
Did a bit more with this, the out of mem was for an png 10x10 which is tiled to full screen using anchors tied to the UIRoot.

Made the image 20x20 and then got:

Too many vertices on one panel: 24661672
UnityEngine.Debug:LogError(Object)
UIDrawCall:Set(BetterList`1, BetterList`1, BetterList`1, BetterList`1, BetterList`1) (at Assets/Plugins/Internal/UIDrawCall.cs:472)
UIPanel:SubmitDrawCall(UIDrawCall) (at Assets/Plugins/UI/UIPanel.cs:1062)
UIPanel:FillAllDrawCalls() (at Assets/Plugins/UI/UIPanel.cs:1019)
UIPanel:UpdateSelf() (at Assets/Plugins/UI/UIPanel.cs:959)
UIPanel:LateUpdate() (at Assets/Plugins/UI/UIPanel.cs:913)

So I guess it's a case of making this larger until it goes away...........

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: NGUI Out of Memory
« Reply #6 on: February 21, 2014, 05:52:43 AM »
Hmmm have taken image size up to 100x100 and still have an error......

Too many vertices on one panel: 781992
UnityEngine.Debug:LogError(Object)
UIDrawCall:Set(BetterList`1, BetterList`1, BetterList`1, BetterList`1, BetterList`1) (at Assets/Plugins/Internal/UIDrawCall.cs:472)
UIPanel:SubmitDrawCall(UIDrawCall) (at Assets/Plugins/UI/UIPanel.cs:1062)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile