The example in the manual states:
It is usually best not to mix garbage-collected allocation with the system malloc
-free
. If you do, you need to be careful not to store pointers to the garbage-collected heap in memory allocated with the system malloc
.
And more specifically for C++:
In the case of C++, you need to be especially careful not to store pointers to the garbage-collected heap in areas that are not traced by the collector. The collector includes some alternate interfaces to make that easier.
Looking at the source code in the manual you will see the garbage-collected memory is handled through specific calls, hence, the management is handled separately (either by the collector or manually). So as long your library handles its internals properly and doesn't expose collected memory, you should be fine. You don't know how other libraries manage their memory and you can use them as well, don't you? :)