Failing PluginVal test, need help


#1

Hi,
so I’m testing our synthesizer plugin with pluginval. First of all it’s a lovely tool, thanks for that!
But I’m failing a level 9 test in all my plugin formats (VST, VST3, AU). Here’s the output of that test:

Starting test: pluginval / Allocations during process...
Testing with sample rate [44100] and block size [64]
!!! Test 1 failed: Allocations occured in audio thread: 262
!!! Test 5 failed: Allocations occured in audio thread: 262
!!! Test 9 failed: Allocations occured in audio thread: 262
!!! Test 13 failed: Allocations occured in audio thread: 262
!!! Test 17 failed: Allocations occured in audio thread: 262
!!! Test 21 failed: Allocations occured in audio thread: 262
!!! Test 25 failed: Allocations occured in audio thread: 262
!!! Test 29 failed: Allocations occured in audio thread: 262
!!! Test 33 failed: Allocations occured in audio thread: 262
!!! Test 37 failed: Allocations occured in audio thread: 262
Testing with sample rate [44100] and block size [128]
!!! Test 41 failed: Allocations occured in audio thread: 262
!!! Test 45 failed: Allocations occured in audio thread: 262
!!! Test 49 failed: Allocations occured in audio thread: 262
!!! Test 53 failed: Allocations occured in audio thread: 262
!!! Test 57 failed: Allocations occured in audio thread: 262
!!! Test 61 failed: Allocations occured in audio thread: 262
!!! Test 65 failed: Allocations occured in audio thread: 262
!!! Test 69 failed: Allocations occured in audio thread: 262
!!! Test 73 failed: Allocations occured in audio thread: 262
!!! Test 77 failed: Allocations occured in audio thread: 262
Testing with sample rate [44100] and block size [256]
!!! Test 81 failed: Allocations occured in audio thread: 262
!!! Test 85 failed: Allocations occured in audio thread: 262
!!! Test 89 failed: Allocations occured in audio thread: 262
!!! Test 93 failed: Allocations occured in audio thread: 262
!!! Test 97 failed: Allocations occured in audio thread: 262
!!! Test 101 failed: Allocations occured in audio thread: 262
!!! Test 105 failed: Allocations occured in audio thread: 262
!!! Test 109 failed: Allocations occured in audio thread: 262
!!! Test 113 failed: Allocations occured in audio thread: 262
!!! Test 117 failed: Allocations occured in audio thread: 262
Testing with sample rate [44100] and block size [512]
!!! Test 121 failed: Allocations occured in audio thread: 262
!!! Test 125 failed: Allocations occured in audio thread: 262
!!! Test 129 failed: Allocations occured in audio thread: 262
!!! Test 133 failed: Allocations occured in audio thread: 262
!!! Test 137 failed: Allocations occured in audio thread: 262
!!! Test 141 failed: Allocations occured in audio thread: 262
!!! Test 145 failed: Allocations occured in audio thread: 262
!!! Test 149 failed: Allocations occured in audio thread: 262
!!! Test 153 failed: Allocations occured in audio thread: 262
!!! Test 157 failed: Allocations occured in audio thread: 262
Testing with sample rate [44100] and block size [1024]
!!! Test 161 failed: Allocations occured in audio thread: 262
!!! Test 165 failed: Allocations occured in audio thread: 262
!!! Test 169 failed: Allocations occured in audio thread: 262
!!! Test 173 failed: Allocations occured in audio thread: 262
!!! Test 177 failed: Allocations occured in audio thread: 262
!!! Test 181 failed: Allocations occured in audio thread: 262
!!! Test 185 failed: Allocations occured in audio thread: 262
!!! Test 189 failed: Allocations occured in audio thread: 262
!!! Test 193 failed: Allocations occured in audio thread: 262
!!! Test 197 failed: Allocations occured in audio thread: 262
Testing with sample rate [48000] and block size [64]
!!! Test 201 failed: Allocations occured in audio thread: 262
!!! Test 205 failed: Allocations occured in audio thread: 262
!!! Test 209 failed: Allocations occured in audio thread: 262
!!! Test 213 failed: Allocations occured in audio thread: 262
!!! Test 217 failed: Allocations occured in audio thread: 262
!!! Test 221 failed: Allocations occured in audio thread: 262
!!! Test 225 failed: Allocations occured in audio thread: 262
!!! Test 229 failed: Allocations occured in audio thread: 262
!!! Test 233 failed: Allocations occured in audio thread: 262
!!! Test 237 failed: Allocations occured in audio thread: 262
Testing with sample rate [48000] and block size [128]
!!! Test 241 failed: Allocations occured in audio thread: 262
!!! Test 245 failed: Allocations occured in audio thread: 262
!!! Test 249 failed: Allocations occured in audio thread: 262
!!! Test 253 failed: Allocations occured in audio thread: 262
!!! Test 257 failed: Allocations occured in audio thread: 262
!!! Test 261 failed: Allocations occured in audio thread: 262
!!! Test 265 failed: Allocations occured in audio thread: 262
!!! Test 269 failed: Allocations occured in audio thread: 262
!!! Test 273 failed: Allocations occured in audio thread: 262
!!! Test 277 failed: Allocations occured in audio thread: 262
Testing with sample rate [48000] and block size [256]
!!! Test 281 failed: Allocations occured in audio thread: 262
!!! Test 285 failed: Allocations occured in audio thread: 262
!!! Test 289 failed: Allocations occured in audio thread: 262
!!! Test 293 failed: Allocations occured in audio thread: 262
!!! Test 297 failed: Allocations occured in audio thread: 262
!!! Test 301 failed: Allocations occured in audio thread: 262
!!! Test 305 failed: Allocations occured in audio thread: 262
!!! Test 309 failed: Allocations occured in audio thread: 262
!!! Test 313 failed: Allocations occured in audio thread: 262
!!! Test 317 failed: Allocations occured in audio thread: 262
Testing with sample rate [48000] and block size [512]
!!! Test 321 failed: Allocations occured in audio thread: 262
!!! Test 325 failed: Allocations occured in audio thread: 262
!!! Test 329 failed: Allocations occured in audio thread: 262
!!! Test 333 failed: Allocations occured in audio thread: 262
!!! Test 337 failed: Allocations occured in audio thread: 262
!!! Test 341 failed: Allocations occured in audio thread: 262
!!! Test 345 failed: Allocations occured in audio thread: 262
!!! Test 349 failed: Allocations occured in audio thread: 262
!!! Test 353 failed: Allocations occured in audio thread: 262
!!! Test 357 failed: Allocations occured in audio thread: 262
Testing with sample rate [48000] and block size [1024]
!!! Test 361 failed: Allocations occured in audio thread: 262
!!! Test 365 failed: Allocations occured in audio thread: 262
!!! Test 369 failed: Allocations occured in audio thread: 262
!!! Test 373 failed: Allocations occured in audio thread: 262
!!! Test 377 failed: Allocations occured in audio thread: 262
!!! Test 381 failed: Allocations occured in audio thread: 262
!!! Test 385 failed: Allocations occured in audio thread: 262
!!! Test 389 failed: Allocations occured in audio thread: 262
!!! Test 393 failed: Allocations occured in audio thread: 262
!!! Test 397 failed: Allocations occured in audio thread: 262
Testing with sample rate [96000] and block size [64]
!!! Test 401 failed: Allocations occured in audio thread: 262
!!! Test 405 failed: Allocations occured in audio thread: 262
!!! Test 409 failed: Allocations occured in audio thread: 262
!!! Test 413 failed: Allocations occured in audio thread: 262
!!! Test 417 failed: Allocations occured in audio thread: 262
!!! Test 421 failed: Allocations occured in audio thread: 262
!!! Test 425 failed: Allocations occured in audio thread: 262
!!! Test 429 failed: Allocations occured in audio thread: 262
!!! Test 433 failed: Allocations occured in audio thread: 262
!!! Test 437 failed: Allocations occured in audio thread: 262
Testing with sample rate [96000] and block size [128]
!!! Test 441 failed: Allocations occured in audio thread: 262
!!! Test 445 failed: Allocations occured in audio thread: 262
!!! Test 449 failed: Allocations occured in audio thread: 262
!!! Test 453 failed: Allocations occured in audio thread: 262
!!! Test 457 failed: Allocations occured in audio thread: 262
!!! Test 461 failed: Allocations occured in audio thread: 262
!!! Test 465 failed: Allocations occured in audio thread: 262
!!! Test 469 failed: Allocations occured in audio thread: 262
!!! Test 473 failed: Allocations occured in audio thread: 262
!!! Test 477 failed: Allocations occured in audio thread: 262
Testing with sample rate [96000] and block size [256]
!!! Test 481 failed: Allocations occured in audio thread: 262
!!! Test 485 failed: Allocations occured in audio thread: 262
!!! Test 489 failed: Allocations occured in audio thread: 262
!!! Test 493 failed: Allocations occured in audio thread: 262
!!! Test 497 failed: Allocations occured in audio thread: 262
!!! Test 501 failed: Allocations occured in audio thread: 262
!!! Test 505 failed: Allocations occured in audio thread: 262
!!! Test 509 failed: Allocations occured in audio thread: 262
!!! Test 513 failed: Allocations occured in audio thread: 262
!!! Test 517 failed: Allocations occured in audio thread: 262
Testing with sample rate [96000] and block size [512]
!!! Test 521 failed: Allocations occured in audio thread: 262
!!! Test 525 failed: Allocations occured in audio thread: 262
!!! Test 529 failed: Allocations occured in audio thread: 262
!!! Test 533 failed: Allocations occured in audio thread: 262
!!! Test 537 failed: Allocations occured in audio thread: 262
!!! Test 541 failed: Allocations occured in audio thread: 262
!!! Test 545 failed: Allocations occured in audio thread: 262
!!! Test 549 failed: Allocations occured in audio thread: 262
!!! Test 553 failed: Allocations occured in audio thread: 262
!!! Test 557 failed: Allocations occured in audio thread: 262
Testing with sample rate [96000] and block size [1024]
!!! Test 561 failed: Allocations occured in audio thread: 262
!!! Test 565 failed: Allocations occured in audio thread: 262
!!! Test 569 failed: Allocations occured in audio thread: 262
!!! Test 573 failed: Allocations occured in audio thread: 262
!!! Test 577 failed: Allocations occured in audio thread: 262
!!! Test 581 failed: Allocations occured in audio thread: 262
!!! Test 585 failed: Allocations occured in audio thread: 262
!!! Test 589 failed: Allocations occured in audio thread: 262
!!! Test 593 failed: Allocations occured in audio thread: 262
!!! Test 597 failed: Allocations occured in audio thread: 262

Time taken to run test: 358 ms
FAILED!!  150 tests failed, out of a total of 600

So it seems we are having allocations on the audio thread. It’s a repetitive pattern. Has anybody an idea where to start looking? What’s best to debug this?


#2

There’s an option in the options menu called “validate in process”. If you run pluginval through your IDE in debug and select that option it should trigger a break point where the test is failing!


#3

Ok, that’s a nice tipp that helps analyzing these tests.
But in my case the test fails after the actual allocations. I’ve looked at it for while and have an idea, where the allocations could happen. Is it possible that this test also looks at the prepareToPlay method? Because that’s the only place I can find right now, that actually allocates dynamically.
Just to be clear: It is ok to dynamically allocate in prepareToPlay, isn’t it?


#4

adding a breakpoint in AllocatorInterceptor::logAllocationViolation() would probably help


#5

Thanks, that helped a lot. Found the culprit!


#6

Would you care to share? Since it was something that wasn’t obvious to you, someone else might benefit from that knowledge and save themselves from accidentally allocating in audio thread :slight_smile:


#7

I was missing an Ampersand when iterating over a map.

// incorrect:
for(auto entry : map)

// better 
for(auto &entry : map)

#8

Fantastic. Good to know this is finding hard to spot things like this!


#9

Definitely! Thanks for making it. Very helpful tool.