I get this error a lot in visual D:
First-chance exception: core.exception.InvalidMemoryOperationError Invalid memory operation at src\core\exception.d(693)
This is the code:
dev.exe!vibe.utils.memory.LockAllocator.free( vibe.utils.memory.LockAllocator this ) Line 143 + 0x3d bytes D
void free(void[] mem)
in {
assert(mem.ptr !is null, "free() called with null array.");
assert((cast(size_t)mem.ptr & alignmentMask) == 0, "misaligned pointer passed to free().");
}
body {
static if (!synchronizedIsNothrow)
scope (failure) assert(0, "Internal error: function should be nothrow");
synchronized(this)
m_base.free(mem);
}
void clear()
{
checkInvariants();
if( m_object ){
if( --this.refCount == 0 ){
static if( INIT ){
//logInfo("ref %s destroy", T.stringof);
//typeid(T).destroy(cast(void*)m_object);
auto objc = m_object;
static if (is(TR == T)) .destroy(objc);
else .destroy(*objc);
//logInfo("ref %s destroyed", T.stringof);
}
static if( hasIndirections!T ) GC.removeRange(cast(void*)m_object);
manualAllocator().free((cast(void*)m_object)[0 .. ElemSize+int.sizeof]);
}
}
dev.exe!vibe.utils.memory.LockAllocator.free( vibe.utils.memory.LockAllocator this ) Line 143 + 0x3d bytes D
m_object = null;
m_magic = 0x1EE75817;
}
This has something to do with class ConnectionPool and the GC. I can skip over the exception but it seems that a better check/fix could be put in place to avoid throwing the exception on common startup cases.