You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TripleBuffer can be reallocated / grown prior to running physics and
rendering. However, once physics and rendering start, reallocating TripleBuffer
becomes difficult.
The easiest way to reproduce this issue is with the multithreaded example. You
can modify the code to initially allocate a very small TripleBuffer. Set a
breakpoint in TripleBuffer::reserve(), then run the simulation. When you hit
return to fire a ball, you'll encounter the breakpoint and you can step through
and watch the reallocation.
There are at least two problems with how reallocation is handled:
1. Reallocating doesn't hold any kind of lock. This means a thread (either
phsics or rendering) could be in the process of obtaining a buffer address at
the exact moment the reallocation occurs.
2. Even holding a lock would not be sufficient, and here's why: Suppose the
physics thread gets the write buffer address, then the buffers are reallocated.
Reallocation copies the old buffer contents to the new buffer, then deletes the
old buffer. Unfortunately, the physics thread has the address of the (deleted)
old buffer. This is a dangling pointer.
Not sure how to resolve this issue. Further investigation required.
Original issue reported on code.google.com by [email protected] on 20 Sep 2010 at 8:35
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 20 Sep 2010 at 8:35The text was updated successfully, but these errors were encountered: