question

MRUTYUNJAYAMAHAPATRA-6389 avatar image
0 Votes"
MRUTYUNJAYAMAHAPATRA-6389 asked MRUTYUNJAYAMAHAPATRA-6389 commented

oleaut32.dll is allocating some more memory for vs2017

Hi,

I have one project in vs2012 which was migrated to vs2017. After migration to vs2017, we observed that it(Process) is consuming memory through oleaut32.dll.

I am using SAFEARRAY * psaItemIds = ::SafeArrayCreate( VT_BSTR, 1, bound ); in my project.
Dubugdiag log indicates to oleaut32.dll which ultimately indicates to SafeArrayCreate

SafeArrayCreate is used in both vs2012 and vs2017 project. After migration why vs2017 project is using more memory through oleaut32.dll .

Can anybody please suggest any idea to reduce memory consumption

Best Regards
Mrutyunjaya

windows-serverwindows-apiwindows-10-networkwindows-platform-network
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you provide a minimal (ideally a simple console) source project that illustrates this memory leak issue?

0 Votes 0 ·

vs2017 Project

Top 9 modules by allocation count

oleaut32 1,142 allocation(s) Extra memory allocation from this module
ntdll 67 allocation(s)
ucrtbase 57 allocation(s)
rpcrt4 10 allocation(s)
CalcDiags 06 allocation(s)
mswsock 06 allocation(s)
msvcrt 03 allocation(s)
combase 02 allocation(s)
EngineServer 01 allocation(s)


Memory Globals.Manager statistics by allocation count
OLE/COM memory Globals.Manager 1,142 allocation(s)
Heap memory Globals.Manager 151 allocation(s)
OLE automation BSTR memory Globals.Manager 01 allocation(s)






0 Votes 0 ·

vs2012 Project

Top 9 modules by allocation count
msvcr110 54 allocation(s)
ntdll 22 allocation(s)
rpcrt4 12 allocation(s)
mswsock 06 allocation(s)
ucrtbase 03 allocation(s
msvcrt 03 allocation(s)
CalcDiags 03 allocation(s)
combase 01 allocation(s)
EngineServer 01 allocation(s)

Memory Globals.Manager statistics by allocation count
Heap memory Globals.Manager 104 allocation(s)
OLE automation BSTR memory Globals.Manager 01 allocation(s)



0 Votes 0 ·
SongZhu-MSFT avatar image SongZhu-MSFT MRUTYUNJAYAMAHAPATRA-6389 ·

Providing this information does not help us to reproduce the problem, could you please show a minimal, reproducible sample without private information? And provide your test environment, such as Windows version, SDK version, etc.

0 Votes 0 ·

HRESULT hr = S_OK;
// Get the online values...
int onlineCount = m_OnlineVars.size( );
int offlineCount = m_OfflineVariables.size( );
SAFEARRAYBOUND bound[1];
bound[0].lLbound = 1;
bound[0].cElements = onlineCount;
**SAFEARRAY psaItemIds = ::SafeArrayCreate( VT_BSTR, 1, bound ); Debugdiag indicates to this line
SAFEARRAY
psaValues = NULL;
SAFEARRAY psaQualities = NULL;
SAFEARRAY
psaTimeStamps = NULL;
SAFEARRAY * psaErrors = NULL;
LONG saIndex = 0;
// Read the values from the data server...
hr = m_DataServer->ReadVariables( onlineCount,
&psaItemIds,
&psaValues,
&psaQualities,
&psaTimeStamps,
&psaErrors );

 ::SafeArrayDestroy(psaItemIds);
 ::SafeArrayDestroy(psaValues);
 ::SafeArrayDestroy(psaTimeStamps);
 ::SafeArrayDestroy(psaQualities);
 ::SafeArrayDestroy(psaErrors);

OS: windows Server 2016
SDK : 10.0.17763.0






0 Votes 0 ·
MRUTYUNJAYAMAHAPATRA-6389 avatar image
0 Votes"
MRUTYUNJAYAMAHAPATRA-6389 answered MRUTYUNJAYAMAHAPATRA-6389 published

vs2012 Project

Top 9 modules by allocation count
msvcr110 54 allocation(s)
ntdll 22 allocation(s)
rpcrt4 12 allocation(s)
mswsock 06 allocation(s)
ucrtbase 03 allocation(s
msvcrt 03 allocation(s)
CalcDiags 03 allocation(s)
combase 01 allocation(s)
EngineServer 01 allocation(s)

Memory Globals.Manager statistics by allocation count
Heap memory Globals.Manager 104 allocation(s)
OLE automation BSTR memory Globals.Manager 01 allocation(s)



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MRUTYUNJAYAMAHAPATRA-6389 avatar image
0 Votes"
MRUTYUNJAYAMAHAPATRA-6389 answered MRUTYUNJAYAMAHAPATRA-6389 published

vs2017
Top 9 modules by allocation count
oleaut32 1,142 allocation(s) Extra memory allocation from this module
ntdll 67 allocation(s)
ucrtbase 57 allocation(s)
rpcrt4 10 allocation(s)
CalcDiags 06 allocation(s)
mswsock 06 allocation(s)
msvcrt 03 allocation(s)
combase 02 allocation(s)
EngineServer 01 allocation(s)

Memory Globals.Manager statistics by allocation count
OLE/COM memory Globals.Manager 1,142 allocation(s)
Heap memory Globals.Manager 151 allocation(s)
OLE automation BSTR memory Globals.Manager 01 allocation(s)

Call Stack of Oleaut32.dll

Function details

Function oleaut32!SafeArrayCreate+153
Source Line
Allocation type OLE/COM allocation(s)
Allocation Count 571 allocation(s)
Allocation Size 111.52 KBytes
Leak Probability 99%



Call stack sample 1

Address 0x00000000
Allocation Time 00:05:52 since tracking started
Allocation Size 200 Bytes



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.