|
The built-in detection mechanisms of the VS work very well for me ie., define new to DEBUG_NEW and so on. When you stop your application it will tell you where the leaks are if you do this.
But, as others have said, the heap manager does not always release unused memory back to the OS. It tries to reuse the free blocks but sometimes memory gets fragmented and it has to allocate more to get a contiguous block of the needed size. You can 'manually' force it to release the memory back to the OS by calling _heapmin().
|
|
|
|
|
I've successfully used the built-in VS leak stuff with DEBUG_NEW, etc in the past. For this, though, its not reporting any leaks. However, when I load a file, then do file>>new and dispose of everything, then repeat the process, I see a roughly constant growth each time. I'm looking at the process private bytes counter.
I wrote a small test app which does HeapCreate/HeapAlloc/HeapFree/HeapDestroy and also new/delete. In either case, when I allocate a bunch of memory and then free it the private bytes immediately drops back down. Whereas in my app I get this persistent repeatable growth each time, yet the VS leak detection isn't kicking in.
I'm not at all concerned about memory being released back to the OS. If the heap manager is holding onto it after my app has freed it (HeapFree/delete) that's acceptable and its an OS issue. I'm worried about cases where I've allocated and not freed the memory myself (regardless of whether or not its been returned to the OS).
|
|
|
|
|
We use Memory Validator here at work and it is fairly awesome.
It will show where both the growth and leaks are occuring, assuming you generate proper PDB files for your project.
|
|
|
|
|
I'll take a look at that. Thanks!
|
|
|
|
|
Hello all,
I hooked NtSetInformationFile to intercept delete call, This is done, Now i have a file which contains name of files and folder need to be protected, Protecting file is no problem as i get the file name from file handle and using strcmp i decide whether to delete the file or not, But how to determine that the file handle i get in NtSetInformationFile is folder?
I tried using GetFileInformationByHandleEx with FileStandardInfo which should give me whether the handle is directory or not, But it always returns TRUE(folder) when there are no files inside and FALSE(not folder) when there are files inside.
Thanks all.
|
|
|
|
|
|
I think i can't.
Let me explain the scenario, I have a empty folder say "abcd" in C: drive and a non-empty folder say "efgh" in C: drive which contains a.txt, b.rar
Now when i access empty folder(i.e try to delete) the path i get is "C:\abcd", which is fine and a query for directory in GetFileInformationByHandleEx return TRUE, But when i access non empty folder the path i get is "C:\efgh\a.txt" and "C:\efgh\b.rar" , Please note i did not access the files inside it but folder. So i guess "PathIsDirectory" won't work..
|
|
|
|
|
gothic_coder wrote: But when i access non empty folder the path i get is "C:\efgh\a.txt"...
The path you get from where?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
GetFileInformationByHandleEx gives me "\efgh\a.txt" , I then use GetFileInformationByHandle with handle to get the volume serial number and then GetLogicalDriveStrings and GetVolumeInformation to compare the volume serial number and attach with "\efgh\a.txt" to get "C:\efgh\a.txt".
|
|
|
|
|
Hi all,
I am writing a little program in which I also work with emails. In order to do so, I want to be able to drop emails onto my dialog. I added all the necessary stuff (like ON_WM_DROFILES() and all that). This all works fine when I drag a file from an explorer window onto my dialog. However, when I try to drag an Outlook email message, this cannot be dropped on my dialog (The cursor remains being the "unable to drop here" icon). When I drag it onto the same explorer window, it does allow dropping there and then causes an .msg type of file. I would like that file (or information from which I can create such a file) to be dropped onto my dialog directly. Any ideas on how to allow dropping of email messages?
Thanks in advance,
William.
|
|
|
|
|
I recommend using OLE Drag and Drop[^] instead of listening for WM_DROPFILES.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Hi,
How to format the date (CTime) using CString?
I need to convert the date like September 2,2010
How to do that?
|
|
|
|
|
As you may easily realize, reading the documentation CTime::Format[^], strftime[^] (for format specifiers):
CTime now = CTime::GetCurrentTime();
CString szDate = now.Format(_T("%B %d,%Y"));
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi!
I got the following exception while running my project.
Unhandled exception at 0x7706a4d2 in SlogOut3D.exe: 0xC00000FD: Stack overflow.
Here is the Call Stack:
> ntdll.dll!7706a4d2()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!77086e27()
ntdll.dll!77086e0c()
ntdll.dll!770d1ec5()
ntdll.dll!7709ba51()
ntdll.dll!77087545()
ntdll.dll!77086e0c()
ntdll.dll!770871e6()
ntdll.dll!77086e0c()
msvcr90.dll!73593db8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
msvcr90.dll!73593eb8()
How to resove this exception?
|
|
|
|
|
T.RATHA KRISHNAN wrote: How to resove this exception?
Debugging?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
None of my functions appeared in the call stack. How do I debug?
|
|
|
|
|
Still you may step with the debugger in your code (make sure you're doing it using the debug build).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi!
Sorry. That Call Stack was the result while running Release mode. But, if I run in Debug mode, I got the following DLL missing error:
This application has failed to start because VCOMP90D.DLL was not found. Reinstalling the application may fix this problem.
What to do?
|
|
|
|
|
It looks like (Google told me) you're using OpenMP: check the requirements at the API page [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can load the symbols from Microsoft servers (even in release mode): http://support.microsoft.com/kb/311503[^]
From what I see, some C runtime function is beeing called recursively and that causes stack overflow.
|
|
|
|
|
Also, if you KNOW you are recursing to a certian depth, expectedly of course, you could always modify your program to have a larger stack size. It seems most developers do not ever attmept this. The default with 32-bit Windows applications built with Visual Studio has been 1 MB for a very long itme.
Also consider moving your data off the stack and into a heap.
Look for alloca calls. Some of the MBCS->Unicode macros also consume stack space per string converted. You get one of those in a recursive function and can kiss your stack bye-bye!
|
|
|
|
|
Hi all,
i m using excel automation to write excel but is write date or any amount with currency symbol its not displayed properly in excel sheet.
please help me how can i display it.
thank in advance.
|
|
|
|
|
What does your call to PutValue() or PutValue2() look like? What does the cell look like afterward?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
HI ,
I am creating CListCtrl at run time and paining its row using CustomeDraw. But If any control is behind the list control, I am able to see and press.
How to draw the list control over another control.
|
|
|
|
|
Make it child of the control.
|
|
|
|