|
Memory fragmentation possibly?
|
|
|
|
|
Falconapollo wrote: Or are there some tools to help me to do that?
Profilers will identify memory usage.
Falconapollo wrote: Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'
Which doesn't mean that memory is not being used incorrectly. For example some sort of map with duplicate data.
Normally, at least for me, I have a fairly good idea of why an application uses code. There are of course only two real sources. First if you have something, one thing, that it is in fact big. And the second is if you have a whole lot of little things. Rather hard to code an application without actually knowing which of those cases is likely.
|
|
|
|
|
As Richard said it's impossible to give accurate advice without seeing your code and the functions you call from third party libs (and of course posting 1400k lines of code is not an option).
The questions you should try to answer for yourself are:
1. Can you pinpoint certain operations (at user interface level) of your applications that result in high memory use?
2. Which internal parts (functions) of your application do require large amounts of memory, even if only temporary?
3. Which calls to third party libraries result in allocation of memory that is not automatically released (e. g. functions that create large objects or data sets to hold results)?
4. What third party libraries do you use, and what do you know about their memory allocation scheme?
The last question is targeted at libraries that use their own memory managers, which may or may not release unused memory blocks in a timely manner.
Find the answers to these questions to better locate possible causes for your problem. Without that info, nobody can really help.
|
|
|
|
|
If the memory is returned, then it's not leaking.
If you had a leak, then then the memory usage would keep growing until your application crashes.
If you want your application to use less memory, then you'll have to look at how you use your data and the lifetime in which you keep it.
|
|
|
|
|
I am trying to enumerate processes and WriteProcessMemory. I get the following errors on compilation in Visual C++. I just don't do anything related to TOKEN and all. How to solve the error ?
error C2061: syntax error : identifier 'TOKEN_INFORMATION_CLASS'
error C2061: syntax error : identifier 'PTOKEN_PRIVILEGES'
error C2061: syntax error : identifier 'PTOKEN_GROUPS'
error C2061: syntax error : identifier 'TOKEN_TYPE'
in file c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h
|
|
|
|
|
I would recommend moving to a newer SDK. 6.0a is very old, has many versioning bugs and is no longer supported for use with Visual Studio versions.
Also make sure you have predefined _WIN32_WINNT for example as 0x0600 to target Vista. If you don't do this SDK 6.0a will default back to Win2K or even Windows 95 that may not support what you're trying to do.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hi I got the answer.. yes its strange and hard to believe but is true.. Declaration of Structure TOKEN_INFORMATION_CLASS is present in WinNt.h header file.. The same was missing in my standard include\winnt.h.. I took the same header file from another machine and the error is solved..
|
|
|
|
|
***** What I want is I should get exact no of entries and filenames as the no of files copied..***** When I copy files in the monitored directory through 4 cmd's all with copy command copying files from windows, system32, c:\, d:\ directory at a time.. this function ReadDirectoryChangesW() does not give correct output. It misses many files entries and also shows repetitive filename as file added and then modified. It is all because till the system writes the file completely, it continuously keeps giving the notification too. so we have multiple entries for same file. ***** What I want is I should get exact no of entries and filenames as the no of files copied.. So I think if I hook CopyFile/CreateFile(A/W) API, then I can trace all the files created/copied in c:\temp (putting c:\temp as the filter).. Please help.. Thanks in advance..
|
|
|
|
|
|
I am getting the following error
error RC2135: file not found: STRINGTABLE
error RC2135: file not found: 0xF000
1>
error RC2135: file not found: 0xF001
1>
None of the items pointed to by the resource compiler are files
I am at a loss
MSDN states for this error The file specified in the Resource Compiler command line was not found
I did a build from Visual Studio Professional 10.0
I don't know what is on the resource compiler command line
|
|
|
|
|
ForNow wrote: I am getting the following error Where?
ForNow wrote: I don't know what is on the resource compiler command line Look in the Properties window.
Use the best guess
|
|
|
|
|
Hi,
I am using ATL::CAxWindow for hosting some Activex control in my mfc mdi application.
How do I use the scrollbars of an atl::CAxWindow ?
The code I used to create ATL CAxWindow.
CAxWindow m_AxWnd;
CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, pContext);
AtlAxWinInit();
RECT altRect;
GetClientRect(&altRect);
m_AxWnd.Create(m_hWnd, altRect, NULL, WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL);
m_AxWnd.CreateControl(L"Some ActiveX control");
Thanks,
|
|
|
|
|
CAxWindow inherits from ATLs CWindow which has a set of Scrolling Methods: EnableScrollBar, GetScrollInfo, GetScrollPos etc so do these handlers do the scrolling? That's presuming they're getting messages from the ActiveX control.
|
|
|
|
|
My legacy app. uses this message handler to do button enabling / disabling. However it gets called very frequently (eg on mouse move).
is there any way of filtering / controlling the messages that cause this function to get called? I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway.
Thanks
|
|
|
|
|
Simon Langdon wrote: I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway. You may need to disable a menu item based on some condition. You may have a counter in one of the status bar panes that needs updating. There are multiple uses for this macro.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yes, to be clear I can't see why _I_ would want to handle this message. But does MFC manage this message handler for every window in my app with a Message Map? I'm trying to decide if there's anything in my code base responsible for calling this unnecessarily.
|
|
|
|
|
|
If the logic that decides if the buttons should be enabled or disabled is too complicated it is advised (do not ask me to find who advised it, I just remember it somehow) that you do not use this method. You could always use CToolBarCtrl::EnableButton() for this and control it from within other parts of the program
|
|
|
|
|
One place that can fire off updating is the internal OnIdle. This is a fake message handler, called from the MFC message loop. So, you'll get updates a lot, but only when the message queue has "calmed down". So, if you get it a lot, it's because you don't have a lot else going on.
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Hello there
I am working on a C++ MFC app that has a user login option and the software will store upto
15 passwords used by a user.
Now i want to store each password used by a user in a string array and make sure that the user
doesn't use an old password when updating the password.
i.e., password once used cannot be re-used and an existing password will expire after a set number of days.
The question is what kind of collection class i need to use for efficient management of old passwords?
CArray?CList? CString array?
Any sample code will help.
Thanks in advance.
|
|
|
|
|
It sounds like a trivial issue, use whichever types you're comfortable with. STL vectors and CStringArrays both leap to mind; do you need to save this data somehow? CStringArrays support CArchive but you may want to think about encryption or some other safety feature.
|
|
|
|
|
If you're only storing CStrings then CStringArray[^] would be a good choice. If you're storing something else, one of the other collections probably would be more appropriate, here[^] are some examples of thier usage, there are lots of others on the web. here[^] is a link that should help you to decide which collection might be best.
|
|
|
|
|
Donguy1976 wrote: The question is what kind of collection class i need to use for efficient management of old passwords? Since you are only dealing with 15, and only searching the collection when the user is logging in (e.g., once per day), it likely does not matter the data structure you use.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
|
Personally I would use a vector, add a new password at the end when needed and remove the first one when size() becomes larger than 15. The scurity issues were already mentioned in the otherreplies.
|
|
|
|