How can I tell how much memory is being used by an instance for AUSampler (including, presumably, the soundFont data size).
I tried a simple sizeof (below) but that doesn’t give me anything I understand. 4? 4 what?
Context for this: I’m creating a musical toy for iOS. AUSampler is monophonic, so two tracks using the same sampler instance cut each others’ notes off. Also soundFonts may have many presets so if I want to use different presets of the same soundFont, I’ll need to create multiple AUSampler instances. Since soundFonts can run to several megabytes or more, I want to determine what my memory overhead will be. – Thanks!
node: 4.000000 unit: 4.000000
Float64 nodeSize = sizeof(samplerNode);
Float64 unitSize = sizeof(samplerUnit);
printf("node: %f unit: %f \n", nodeSize, unitSize);
Use Instruments from Xcode to report the memory usage of your app, and then try running your app with different numbers of instruments to get data to calculate the memory usage of each additional one.
The amount of memory used by any object, such as an AUSampler, can be very different from the size of an object (which is much larger than the size of an object pointer).