Calling WebBrowser.Document.InvokeScript and then calling the eval() in the script causes a memory leak.Calling the following line, where jsonMessages is a json object of 27k is size will result in a virtual memory allocation of 81,920 bytes that is never collected. The same line, with a small object of 1k in size does not causes the memory leak.var message = eval('(' + jsonMessages + ')');The stack trace of the allocation is below.Note that is includes Debug method calls, despite being compiled in release mode.ntdll!NtAllocateVirtualMemory( HANDLE, PVOID*, ULONG, PULONG, ULONG, ULONG )KERNELBASE!_VirtualAllocEx@20() + 0x44 bytesKERNELBASE!_VirtualAlloc@16() + 0x18 bytesjscript9!PageAllocator::AddPageSegment( class DListBase<class PageSegment> & ) + 0x3b bytesjscript9!PageAllocator::SnailAllocPages( unsigned int,class PageSegment * * ) + 0xdf7 bytesjscript9!PageAllocator::AllocPages( unsigned int,class PageSegment * * ) + 0x46 bytesjscript9!ArenaAllocatorNoFreeList::AddBigBlock( unsigned int ) + 0x4f bytesjscript9!ArenaAllocatorNoFreeList::SnailAlloc( unsigned int ) + 0x92 bytesjscript9!PoolAllocator::Alloc( unsigned int ) + 0x1f6 bytesjscript9!Js::GlobalObject::DefaultEvalHelper( class Js::ScriptContext *,unsigned short const *,int,unsigned long,unsigned long,unsigned short const *,int ) + 0x13a bytesjscript9!Js::GlobalObject::EntryEval( class Js::RecyclableObject *,struct Js::CallInfo,... ) + 0x1ae bytesjscript9!Js::JavascriptFunction::CallFunction( class Js::RecyclableObject *,void * (cdecl*)(class Js::RecyclableObject *,struct Js::CallInfo,...),struct Js::Arguments ) + 0x87 bytesjscript9!Js::InterpreterStackFrame::OP_CallFld( struct Js::OpLayoutCallFld *,unsigned int ) + 0x4d bytesjscript9!Js::InterpreterStackFrame::ProcessWithDebugging( void ) + 0x94e bytesjscript9!Js::InterpreterStackFrame::DebugProcess( void ) + 0x3e bytesjscript9!Js::InterpreterStackFrame::DebugProcessThunk( void * & ) + 0x69 bytesjscript9!Js::InterpreterStackFrame::InterpreterThunk( class Js::RecyclableObject *,struct Js::CallInfo,... ) + 0x846ad bytesjscript9!Js::JavascriptFunction::CallFunction( class Js::RecyclableObject *,void * (cdecl*)(class Js::RecyclableObject *,struct Js::CallInfo,...),struct Js::Arguments ) + 0x87 bytesjscript9!Js::JavascriptFunction::CallRootFunction( class Js::RecyclableObject *,struct Js::Arguments,class Js::ScriptContext * ) + 0xa9 bytesjscript9!ScriptSite::CallRootFunction( class Js::JavascriptFunction *,struct Js::Arguments,struct IServiceProvider *,void * * ) + 0x4f bytesjscript9!ScriptSite::Execute( class Js::RecyclableObject *,struct Js::Arguments *,struct IServiceProvider *,void * * ) + 0x5f bytesjscript9!JavascriptDispatch::InvokeOnMember( long,unsigned long,unsigned short,struct tagDISPPARAMS *,struct tagVARIANT *,struct tagEXCEPINFO *,struct IServiceProvider * ) + 0xffffd5d2 bytesjscript9!JavascriptDispatch::InvokeEx( long,unsigned long,unsigned short,struct tagDISPPARAMS *,struct tagVARIANT *,struct tagEXCEPINFO *,struct IServiceProvider * ) + 0x456cd bytesmshtml!CScriptCollection::InvokeEx( class CScriptContext *,long,unsigned long,unsigned short,struct tagDISPPARAMS *,struct tagVARIANT *,struct tagEXCEPINFO *,struct IServiceProvider * ) + 0x95 bytesmshtml!CWindow::InvokeEx( long,unsigned long,unsigned short,struct tagDISPPARAMS *,struct tagVARIANT *,struct tagEXCEPINFO *,struct IServiceProvider * ) + 0x1d88 bytes[Truncated]
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results