CString::Right() and ::Left() leaks memory

I'm running VC6.
     I was getting memory leaks when I compared the results of a Left()
and Right() call to a string constant. This was the code that did it:
	const CString &sName = map.m_sName;
	if (sName.Left(4) == "Lang" && sName.Right(13) == "Category1Name") {
I wasn't concerned that the length of sName might be shorter than the
substrings, because the MSDN says that these methods can handle that
situation. However, when I changed the code to:
	const CString &sName = map.m_sName;
	BOOL bRightTooShort = sName.GetLength() < 13, bLeftTooShort =
sName.GetLength() < 4;
	if ((!bLeftTooShort && sName.Left(4) == "Lang") && (!bRightTooShort &&
sName.Right(13) == "Category1Name")) {
I can't image how that would fix a memory leak unless there's some bug
in the old CString.

0
5/18/2006 3:25:42 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
655 Views

Similar Articles

[PageSpeed] 51

Reply:

Similar Artilces:

outlook 2003 memory leak? /messages display as"none" and eats up memory
Hi there; When a certian user opens outlook, and clicks on sort by size, half of her e-mails disappear, and "none" is displayed. She said this happened to her at home, except she was on her normal view which is sort by date. The only way that I can recreate the problem is to click on sort by size. If you click on one of the "none's" or even hover the mouse over it, the memory will spike up! I had the performance tab open while I was doing this, and the memory being used was read at 1.46 GB! And if I close outlook the memory drops down to normal. I took ...

rights for running budget integration
We are using GP 10 and setting up new security roles for our users. Does anyone know which rights a user needs in order to run a budget integration. I'm having a hard time pinpointing exactly what to give to the user. If I haven't given enough information please ask away! thanks in advance. When you use the word, integration, do you mean you are using Integration Manager? -- Charles Allen, MVP "LSM" wrote: > We are using GP 10 and setting up new security roles for our users. > > Does anyone know which rights a user needs in order to run a budget &g...

Memory usage in XP (memory leak detection)
Hi How can I found out the memory usage on XP ? My XP box uses over a week all memory and then has no resources available. It has 4GB memory (3.5 GB free) I used typeperf with the following: \Memory\Available Bytes \Memory\Committed Bytes \Memory\Pool Paged Bytes \Memory\Pool Nonpaged Bytes \Memory\Cache Bytes \Memory\Cache Bytes Peak \Process(_total)\Virtual Bytes Peak \Process(_total)\Virtual Bytes \Process(_total)\Working Set Peak \Process(_total)\Working Set \Process(_total)\Page File Bytes Peak \Process(_total)\Page File Bytes \Process(_total)\Private Bytes \Proc...

Cursor automatically moves to the left in header/ footer and text boxes
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Hello, Whenever I try to type in a header or footer or a text box, the cursor automatically moves to the left. If I type really fast then it is fine, but if I stop for a moment it will automatically start typing at the beginning. I can't highlight anything (it automatically unhighlights) and I can't change fonts or sizes! I have even tried deleting office from my computer and reinstalling, but the problem is just the same. This is very frustrating. Please help! ...

How do I makes the left Word icons smaller?
The icons in the left vertical task bar have been resized too large and cause me to have to scroll down to Close. I'm sure I did this by mistake. How can I restore them to a smaller size? As far as I can see there is no "Large Icons" option in Customize in Word 2007 as there is in earlier versions, so the only explanation I can think of is a change in screen resolution. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Nannie" <Nannie@discussions.microsoft.com> wrote in message news:CB...

Remove Domain Admin Rights to Exchange
I have seen this discussed before, but nobody ever posted a real solution. The issue is that we have a real split administrative model in our company. Those that are Domain Admins should not necessarily be doing anything in Exchange. Domain Admins, however, has somehow been inherited above the ORG level. Let me qualify this by saying I do know that the problem can sometimes be a matter of removing people from domain admins that are not trusted. That we are working on. However, it is a whole project in itself. That doesn't solve my immediate problem. So, can someone explain why Dom...

How can I change worksheet direction from right to left
I want to change the direction of the work sheet in Excel 2007 from left to right and vice versa If you mean you want to change the direction of the cursor on Enter, then click on the round logo top left, select Excel options, select Advanced, and change the direction to Left, Right, Up or Down as you desire. -- HTH Kassie Replace xxx with hotmail "Haitham" wrote: > I want to change the direction of the work sheet in Excel 2007 from left to > right and vice versa I believe the only way is to go through Microsoft Office Tools and make the setting ...

memory sharing between threads
I got two threads, thread A and thread B. Both of them were running. Now, before thread B is going to terminate, it creates a file mapping object and writes something in it, then PostThreadMessage() to thread A, and thread B terminates. On receiving the thread message from thread B, thread A wants to open the file mapping object and read in data. But, unfornuately, it's already closed when thread B terminates. I know SendMessage() wouldn't return until the message is processed. But it requires a window handle of thread A. I just couldn't pass a handle between two independen...

Exchange 2003 Service Pack 2 / store.exe process is allocating more memory than usual
I am getting the following error message on a regular basis: Alert on SERVER001 at 12/20/2005 8:25:22 PM The store.exe process is allocating more memory than usual. Check to see if you are having problems with e-mail. If so, stop and then restart the Microsoft Exchange Information Store service. You can disable this alert or change its threshold by using the Change Alert Notifications task in the Server Management Monitoring and Reporting taskpad. I have found a fix for this for Exchange 2003 Service Pack 1: SBS2003-KB843539-X86-ENU.EXE But when I try to run it, I get an error th...

Hyperlink in Excel opens the right program, but can't read file.
I use many hyperlinks to direct users to the correct files. Even if I use a hyperlink to another program, the program opens and the files are viewed in the correct program. I am having a unique problem to a program called "editNC" (file extensions .ncc). The program opens when you click on the hyperlink that is in my Excel workbook, but I get the error message "Unable to Read File" after the editNC program window opens. Also, up on the top bar of the editNC program it is saying that the file is "read only". If I open the file directly from editNC, I ha...

GlobalMemoryStatusEx returns very big virtual memory size on x64
Even with the sample code from http://msdn2.microsoft.com/en-us/library/aa366589(VS.85).aspx I get very big values. It seems like a bug on x64 platforms (I could be wrong and in fact it might be a cast problem). The values below are in bytes (I don't think my computer has 8191 = 0x1FFF GB total virtual memory) Total Virtual Memory 8796092891136 Avail Virtual Memory 8796008636416 And more, the same code compiled as x32 bit binary and as x64 bit binary returned different values but only for VM size (but if you look close you may see a mask 0x07FFFFFF which can be applied): c:\>TestV...

Form not loading right
Access 2003. I have a data entry form. I have an option group set up so the user can select the active patients or the inactive patients. Right now when I open the form, the radio button for active patients is selected but the inactive patients are actually showing. I have to click the inactive radio button then re-click the active radio button for the active patients to show. The option group is located in my form header. What's going on? I think I need to do something with the on load property of the form? Right now I have a macro to maximize on load. I looked at the other...

Remove left text string
I have a column of text which has 42 characters (which are the same) and then names of various clients. I'd like to get a formula to remove the first 42 characters and just give me the names of each client. I've tried with LEFT and RIGHT, but to no avail. Thanks for any help, Luc =RIGHT(A2,LEN(A2)-42) -- HTH RP (remove nothere from the email address if mailing direct) "Luc in Oxford" <LucinOxford@discussions.microsoft.com> wrote in message news:7F83AB1B-E651-4CBA-9B41-8EB9B395E05B@microsoft.com... > I have a column of text which has 42 characters (which ...

CString::format...
I want to cause CString.format such as the following CString.Format (_T("%2.1f"), MyDouble); to create output that looks like the following xx.x %. How do I include the % sign at the end of my number? RABMissouri Use %% "RBert" <drbert@microcore.net> a �crit dans le message de news: #3pWTX65DHA.3664@tk2msftngp13.phx.gbl... > I want to cause CString.format such as the following CString.Format > (_T("%2.1f"), MyDouble); > to create output that looks like the following xx.x %. How do I include > the % sign at the end of my number? > &...

Getting Compaq to Boot With 4 Gig Memory
We have a Compaq W8000 workstation with 4 GB of memory installed. Unfortunately Windows can only retrieve and use about 3.61 GB of that. It looks like the BIOS of various cards might be locking up part of the first 640 KB of memory? Can anyone give some advice on how to get Windows to get use of the full 4GB of memory? -- W On Mar 9, 7:40=A0pm, "W" <persistent...@spamarrest.com> wrote: > We have a Compaq W8000 workstation with 4 GB of memory installed. > Unfortunately Windows can only retrieve and use about 3.61 GB of that. = =A0 It > looks like...

In right scroll bar can you change the page # in view box to sect.
The scroll bar on the right show in the view box the page number and then text from the document, can you change what the view box shows from page number to sections? Sueann wrote: > The scroll bar on the right show in the view box the page number and > then text from the document, can you change what the view box shows > from page number to sections? No, there is no option to control that display. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benef...

Finding Memory Leaks
Hi all, I have a MFC/C++ Application developed. I see a lot of Memory Leaks Dump in the Visual Studio output window when run the app via the debugger. My application consists of an exe, and a few DLLs. The DLLs are loaded by the exe using LoadLibrary. And any memory leaks are in any of the DLLs, there is no info like where in the sourcecode (file name and line number) where the leak was caused. All that I see is the number of bytes of leaked. Whereas, any leak in the EXE shows exact info about file name and line number. Any help/tips/suggestions to help me solve the memo...

Memory problems in Excel 2003
I have a workbook developed in 2002. Recently we have upgraded to 2003, and every time the workbook is opened the error "Microsoft Office has encountered a problem and needs to close", and will not open. The same file still continues to open in 2002. Deleting 2 sheets (any 2 sheets) from the 18 present allows the workbook to open in Excel 2003. Is there anyway to work around this problem (the file is only 1.8Mb in size)? Have you tried repairing your workbook? http://www.officearticles.com/excel/troubleshoot_your_workbook_in_microsoft_excel.htm ************ Anne Troy www.Offic...

information rights management service
i use the "information rights management service" to lock a file with a bunch of stuff on it i want to keep private. as of 2 days ago i cannot access it. it keeps saying i do not have permission with this file. even though i am logged in. help. i need to get access to the files. how can i solve this..... -- Computer struggler ...

Who could tell me if my idea is right?
I write a program using VC6.0,In my program,it include some controls, for example MSComm control,MSFlexGrid control,MS ADO data control,MS DataGrid control,and a database for MS office 2000 Access.If I compile the project selecting option:Use MFC in a Shared Dll,I make the setup program only including the executable file and the database for Access, don't it?who could tell me if my idea is right? You can do it the way you described it, but then you are assuming that the client will have all the dependent controls on his/her machine. How can you ensure that? You will need to dig further ...

wparam to char or CString
how can I convert wparam into a character(in PreTranslateMessage)? thanks A WPARAM is internally just an integral type, as is a char, but it is larger. If you want a single char, you can simply and safely cast the WPARAM to (char), (wchar_t), or (TCHAR). However, if you want a CString, that's a different matter. A CString is not a built-in type, and can not therefore be simply obtained by a cast. However, you could pass a pointer to your string variable, and then cast to the pointer type. You must be careful to test your result to ensure that the pointer value you get is trul...

Limiting access right base on login name?
Hi, I am looking for a sample or guideline for limiting right of user in accessing to some forms and reports based on their login name. eg I want to limit ordinary users to access to some features or forms that has been designed for Administrator use. SF SF wrote: > I am looking for a sample or guideline for limiting right of user in > accessing to some forms and reports based on their login name. eg I > want to limit ordinary users to access to some features or forms that > has been designed for Administrator use. Depends on what you mean by "limiting". If you...

Mailbox Rights #12
Hello, Running a 2003 AD domain with 1 exchange 2003 sp2. When we assign a user full access to another's mailbox, the change does not allow that user full access to that mailbox. Instead, as a workaround, we have to open the user's mailbox and add the rights directly from the person's Outlook client. Anyone have any suggestions to what might not be working? -- Thanks, Jeff Hi Jeff, I am not an expert, far from it but perhaps I can help. I have a few users with full access with no issues but I do not have SP2 installed but planning on it in the next couple of days. Whe...

pass CString?
I want to pass an array of UINT to another window through postmessage. in first winodw, dump those data to the string using string.Format. In the next window, I have to calulate the length and use atoi to get the data. Any other simpler way of doing this? I got to use the CString object to pass around, cause sometimes, I have to pass string. thanks sscanf "Patrick Zou" <patrick_zou@no_spam_hotmail.com> wrote in message news:OkiWLdeZEHA.2500@TK2MSFTNGP09.phx.gbl... > I want to pass an array of UINT to another window through postmessage. in > first winodw, dump those d...

VLOOKUP
Guys, Any ideas how to avoid the left hand side of the page rule wit VLOOKUP, I the lookup value must always been the left foremost column Any ideas how to avoid this by using a formula within a vlookup. Please illustrate clearly and explain reasons why it work? Thanks in advance -- grphillip ----------------------------------------------------------------------- grphillips's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1595 View this thread: http://www.excelforum.com/showthread.php?threadid=27486 Hi, You might want to try: =INDEX(ReturnValueRange,MATCH...