[Openal-devel] ALC_ENUMERATE_ALL_EXT and pluggable sound devices
Stefanos A.
stapostol at gmail.com
Fri Sep 18 09:48:57 PDT 2009
On Fri, 2009-09-18 at 12:21 -0400, Ryan C. Gordon wrote:
> > Yes it *is* a killer, because string allocations engage the GC in
> > managed languages (yes, there is stuff other than C/C++ that relies on
> > OpenAL). Such an approach would be completely unsuitable for such
> > environments.
>
> You only do an allocation when the device list changes in my example. If
> you can't handle that, you need a better garbage collector. :)
1. You need an allocation whenever you cross heap boundaries (i.e. pass
an unmanaged string to a managed environment). This goes deeper than the
specific GC implementation: by definition, a GC may not touch unmanaged
memory.
2. Most modern environments work on unicode rather than ASCII, which
involves an allocation *and* a translation.
I am sorry, but using strcmp just to check a boolean flag is bad API
design (not to mention inefficient, idiomatic and unportable). It might
be me, but I really cannot see what advantage you think it confers over
a plain boolean query.
More information about the Openal-devel
mailing list