Horribleness of using raw malloc?

Hello, Juced Ones.

AudioSampleBuffer wasn’t allocating enough memory for my fairly large buffers (75MB - I’m keeping a whole CD track in memory at one time) - juce_malloc returned NULL - so in fear and trepidation I went to using malloc which is seeming to work.

What’s likely to happen if I just use raw malloc? Is it just “paging and a gap in my audio” (which I can certainly live with in this version?) On modern systems, shouldn’t we be able to request “as much memory as we want” to more or less the limit of the swap partition - if we don’t mind the occasional paging?

Well what’s your target system? I mean, most PCs have a couple of gigs…75MB doesn’t seem like much I could sneeze and use that in a second.

Right, and my target system is pretty large - and this test system has like 14 gig of RAM.

I was quite surprised that it crapped out on such a small RAM allocation and even more surprised when using my own malloc fixed it…

juce_malloc normally just calls straight through to the normal malloc - but are you using Windows in debug mode? If so, it’s probably using the MS debug malloc, so that might be the reason it’s crapping out with large sizes?

Mac debug - but I think you’re exactly right, investigation shows I’m in fact calling a debug malloc!

Very interesting. I have a workaround with the hard-coded malloc and am inclined not to worry about this given an incipient deadline :-D.