Skip to main content

Chrome console shows error Error preallocated buffer overflow memory leak

This could be due to too many callbacks being used through the DoTween library. Specifically it could be caused by calling DoScale() and SetDelay() on many objects at once. For example:

ball.transform.DOScale(ballScale, scaleUpDuration).SetEase(scaleUpEase).SetDelay(thisDelay).OnStart(() => SetObjectNonKinematic(shot)).SetUpdate(true);

images-large

Possible solution:

  • Don’t use the DoTween library on many objects at once with delay callbacks. Instead implement your own function such as scaling with a Lerp function in a Coroutine. For example:
void Start()
{
StartCoroutine(ScaleObject());
}

IEnumerator ScaleObject()
{
while(transform.localScale.x < 1f)
{
//wait for 0.1 seconds before applying the scale up
yield return new WaitForSeconds(0.1);
transform.localScale = new Vector3(transform.localScale.x + 0.1f
transform.localScale.y + 0.1f,
transform.localScale.z + 0.1f);
}
}