When I use spindermonkey dynamic libraries in the windows, spindermonkey compiler does not use debug mode (. / Configure), but also in other dynamic library (using the / MDd compilation mode) using this dynamic library in debug mode,then will produce RtlValidateHeap error. The reason is JSAutoByteString class used JS_EncodeString application memory, but the memory is released using free. The following is Microsoft's explanation : If this ASSERT fails, a bad pointer has been passed in. It may be * totally bogus, or it may have been allocated from another heap. * The pointer MUST come from the 'local' heap .