# Paused before potential out-of-memory crash

**URL:** <https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028>\
**Category:** Questions\
**Created:** [March 6, 2020, 7:50am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028 "2020-03-06T07:50:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 7:50am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/1 "2020-03-06T07:50:52Z")

</div>

paused before potential out-of-memory crash。

 ![7{FS)XB6WZIY](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/3/330b4812331e3acac536f13d7b994783d01b79eb.png)  
This error occurred during the upgrade from 4.1.0-beta.3 to 4.1.0. After building, the volume of babylon.js 4.1 did not shrink, but increased.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 8:19am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/2 "2020-03-06T08:19:34Z")

</div>

That’s the first time in my life I am seeing this error!

Can you reproduce this? Playground maybe? What size of model(s) are you trying to clone?

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 8:28am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/3 "2020-03-06T08:28:27Z")

</div>

4.0 and 4.1.0-beta are running normally. I just upgraded NPM update to 4.1. Build is running normally, but the browser runs with this error. It can’t be reproduced in the playground. No clone is used. Instance is used. There are about 30-40 gltf original models and 1000 scene instances.

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 8:30am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/4 "2020-03-06T08:30:43Z")

</div>

4.0, 4.1.0-beta takes up 600M of memory. 4.1 the memory used in error reporting is 3+ G

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 8:30am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/5 "2020-03-06T08:30:46Z")

</div>

The last function called before it crashes is clone, this is why I was asking about clone.

Would be great to see a reproduction of this. Even your code running somewhere, to try and figure out what the problem is.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 8:31am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/6 "2020-03-06T08:31:22Z")

</div>

That’s a serious increase in mem use. Is 4.2 alpha the same?

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 8:35am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/7 "2020-03-06T08:35:15Z")

</div>

No test 4.2 alpha

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 8:43am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/8 "2020-03-06T08:43:22Z")

</div>

Ok.  
would be great if you could test it, and would be great if you could reproduce such an increase in memory usage so we can fix that

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 8:51am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/9 "2020-03-06T08:51:05Z")

</div>

![WMUA7RZ29E8BYGP0RQX](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/8/8f0970f653a032b4c96a2ee9f80126d13771666b.png)  
This is the code I used to create the gltf instance. The red box is the clone animation (I want each gltf instance to have its own animation). After I delete the red box code, it will run normally. In the previous version of Babylon, there was no good way to create an instance for the complex gltf, which was scribbled by myself, resulting in many problems. Now it is able to run normally, but my scene has become very fuzzy and the effect is very poor.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 9:00am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/10 "2020-03-06T09:00:22Z")

</div>

Would you be able to reproduce this code in the playground? or provide the model?

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 9:13am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/12 "2020-03-06T09:13:16Z")

</div>

A cabinet model, which is a complex model, composed of multiple mesh, also has the animation of door opening. There are many cabinets in the machine room. How can I replicate it with the best performance, clone or instance?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 9:14am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/13 "2020-03-06T09:14:28Z")

</div>

It depends on the use case, of course.

But you are saying that the problem is happening during animation cloning, no?

Do you have the model hosted somewhere?

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 9:19am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/15 "2020-03-06T09:19:00Z")

</div>

Availability is not guaranteed.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 9:23am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/16 "2020-03-06T09:23:26Z")

</div>

Is it possible to enable cors on the server? or maybe host it on github? it will help us very much to load it in the playground and help you much better

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 9:34am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/17 "2020-03-06T09:34:27Z")

</div>

[https://raw.githubusercontent.com/zhang-917917/open\_resources/master/EFAA108476604377BE7372D165444464/EFAA108476604377BE7372D165444464.gltf](https://raw.githubusercontent.com/zhang-917917/open_resources/master/EFAA108476604377BE7372D165444464/EFAA108476604377BE7372D165444464.gltf)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 9:37am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/18 "2020-03-06T09:37:14Z")

</div>

Great! that’s a start 🙂

[https://playground.babylonjs.com/#1GDEU4](https://playground.babylonjs.com/#1GDEU4)

Could you add the code that has been causing the issues?

---

<div class="post-metadata">

**Author:** ![zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@zhang](https://forum.babylonjs.com/u/zhang)\
**Post date:** [March 6, 2020, 9:49am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/19 "2020-03-06T09:49:30Z")

</div>

[https://playground.babylonjs.com/#P4MFKM](https://playground.babylonjs.com/#P4MFKM)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 10:05am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/20 "2020-03-06T10:05:13Z")

</div>

The problem is that you are creating a never ending loop - you are cloning an animation on the instance object, which is added to the parent object. So the animations array keeps on growing.  
But it seems like it is unneeded - the animation array of the instance already has the animations of the parent object

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 6, 2020, 10:07am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/21 "2020-03-06T10:07:07Z")

</div>

This - [https://playground.babylonjs.com/#P4MFKM#1](https://playground.babylonjs.com/#P4MFKM#1)

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [March 6, 2020, 10:12am UTC](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028/22 "2020-03-06T10:12:48Z")

</div>

A commendation 🏆 on your patience in helping zhang.

[Next page](https://forum.babylonjs.com/t/paused-before-potential-out-of-memory-crash/9028.md?page=2)
