I try to use Parallel Studio in order to debug a memory problem I have, I explain :
I have 2 version of my application, a 32 bits and a 64 bits, the problem is that in some situation when
I do a malloc (of 128 MB by example) it returns NULL.
When I check in the task-manager it tell me that my application is 1Gb.
[SergeyK] The Task Manager allows to see many memory related values. You should lookfor 'Memory Usage' and 'Virtual Memory Size' values. A combined value cannot exceed 2GB on a 32-bit Windowsplatform.
The problem occur in both 32 bits and 64 bits but I don't know why !
[SergeyK] Verify values'Initial Size' and 'Maximum Size' for a Virtual Memory file.
I've donelots of testing with 'malloc' CRT-function and on32-bit Windows platforms ( without AWE )it cannot allocate more then ~1.1GB of memory in a single call. If it cannot allocate 128MB of memory it is an indication that a 2GB limit is exceeded.
It is not clear for me why it cannot allocate 128MB of memory on a 64-bit Windows platform and something is really wrong.
Do youhave thatproblem in both configurations, that isinDebug and Release? Take into account that in Debug configuration a memory block will be allocated by a 'malloc_dbg' CRT-function and it always allocates more memory because of addition of some number of bytes at the end of a memory block for Memory Leaks Detection subsystem and for detection ofBuffer Overrun cases.
Parallel Studio seems to find nothing !
BTW : My machine is a Windows 7 with 16 Gb of memory. I use Visual Studio C++ 2010.
Where can find 'Memory Usage' and 'Virtual Memory Size' in task manager ? I have even search in the Resource Monitor but can't find theses fields !( I use windows 7 64 bits ).
Why should I check for the 'virtual memory' size ? I have 16 Gb of memory ! The resource monitor tell me that I still have 10GB free.
Yes, I know about the malloc_dbg and even I have my own 'malloc' method... where I try to check that there is no buffer access violation, that I don't free it several times etc... I have try with/without my malloc and it is the same !
I have also test the release version and have the same problem unfortunately :-(
I have even try to set the/LARGEADDRESSAWARE flag under the 64 bits version, but it is the same. Anyway I think that I don't have to set it !
Where can find 'Memory Usage' and 'Virtual Memory Size' in task manager ?...
[SergeyK] I enclosed a screenshot butit isfor a32-bit Windows XP.If a 'Processes' property page is selected columns are selected from additional dialog box:
'View' -> 'Select Columns...' -> dialog box appears -> columns can be selected
On Windows 7 it has to be available as well.I think Resource Monitor should have columns selection somewhere.
Why should I check for the 'virtual memory' size ?
[SergeyK] This is one of my standard verifications when some memory problem happens,especially when lots of memory allocated. If you're confident that everything is fine there you could ignore my advise.
Note: The screenshot is from a different post and it was related to tests with 'malloc' CRT-function
... I have 2 version of my application, a 32 bits and a 64 bits, the problem is that in some situation when I do a malloc (of 128 MB by example) it returns NULL.When I check in the task-manager it tell me that my application is 1Gb. The problem occur in both 32 bits and 64 bits but I don't know why ! ...
[SergeyK] 1.Take a look at 'SetProcessWorkingSetSize' or 'SetProcessWorkingSetSizeEx' Win32 API functions on MSDN.
2. Verify STACK and HEAPReserve & Commit values in Project Settings ( for Linker ).
3. Did you verify your application for any Memory Leaks?
4. Could you create a simple test case that reproduces the problem? It would be interesting to seehow memory is allocated and released.
Parallel Studio seems to find nothing ! ... [SergeyK] This is expected because you have a runtime problem, not a compile or link.
I would suggest to use Process Explorer from Sysinternals suite.The best opotion should be Windbg as a ultimate tool for memory inspection.Try to use also LeakDiag application from Microsoft which can reveal memory leaks.