Only dump SessionEvent pool in debug builds
This ensures that the user will see a "POOL OUT OF MEMORY" message. In rare case dumping the pool can segfault when printing the Event, The pool is zero initialized and only ever contains events, so in theory it is safe to print them..
This commit is contained in:
parent
ef2c1d990b
commit
25d1209bb4
@ -67,7 +67,13 @@ SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
|
|||||||
a CrossThreadPool for use by this thread whenever events are allocated/released
|
a CrossThreadPool for use by this thread whenever events are allocated/released
|
||||||
from SessionEvent::pool()
|
from SessionEvent::pool()
|
||||||
*/
|
*/
|
||||||
pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems, [](size_t i, void*p) { std::cout << i << " " << *static_cast<SessionEvent*> (p) << "\n";});
|
pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems,
|
||||||
|
#ifndef NDEBUG
|
||||||
|
[](size_t i, void*p) { std::cout << i << " " << *static_cast<SessionEvent*> (p) << "\n"; }
|
||||||
|
#else
|
||||||
|
NULL
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionEvent::SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn, bool yn2, bool yn3)
|
SessionEvent::SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn, bool yn2, bool yn3)
|
||||||
|
@ -86,13 +86,12 @@ Pool::alloc ()
|
|||||||
|
|
||||||
if (free_list.read (&ptr, 1) < 1) {
|
if (free_list.read (&ptr, 1) < 1) {
|
||||||
PBD::stacktrace (std::cerr, 20);
|
PBD::stacktrace (std::cerr, 20);
|
||||||
|
|
||||||
if (_dump) {
|
if (_dump) {
|
||||||
|
printf ("RingBuffer write-idx: %u read-idx: %u\n", free_list.get_write_idx (), free_list.get_read_idx ());
|
||||||
void** _block = free_list.buffer ();
|
void** _block = free_list.buffer ();
|
||||||
for (size_t i = 0; i < free_list.bufsize (); ++i) {
|
for (size_t i = 0; i < free_list.bufsize (); ++i) {
|
||||||
_dump (i, _block[i]);
|
_dump (i, _block[i]);
|
||||||
}
|
}
|
||||||
printf ("RingBuffer write-idx: %u read-idx: %u\n", free_list.get_write_idx (), free_list.get_read_idx ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal << "CRITICAL: " << _name << " POOL OUT OF MEMORY - RECOMPILE WITH LARGER SIZE!!" << endmsg;
|
fatal << "CRITICAL: " << _name << " POOL OUT OF MEMORY - RECOMPILE WITH LARGER SIZE!!" << endmsg;
|
||||||
|
Loading…
Reference in New Issue
Block a user