Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 100% CPU time parsing nasty template code...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

studoot
Senior Member

35 Posts

Posted - Feb 08 2006 :  06:14:04 AM  Show Profile  Reply with Quote
I'm using the Loki library from Andrei Alexandrescu's book Modern C++ Design, specifically his implementation of the Visitor pattern. I'm finding that when I scroll to code containing bits of the Visitor implementation, VAX takes 100% CPU time and doesn't appear to ever terminate. I've confirmed it's VAX (to the best of my abilites) by disabling VAX & scrolling through the same code.

I've distilled the code (my code and the Loki code) to a minimal working example that illustrates the problem. This is available @ http://www.studoot.demon.co.uk/a.minimal.cpp.

To illustrate the problem, create a new Win32 Console application in VS2003. Add a.minimal.cpp and open it. Scroll down to the first Loki::Visitor definition and watch the CPU go to 100%.

NB - this doesn't appear to happen with VS2005 - but it is *definitely* caused by VAX in VS2003...AFAICT!

Stuart Dootson

VAX Details:

VA_X.dll file version 10.2.1440.0 built 2006.01.17
Licensed to:
VA X: [email protected] (1-user license) Support ends 2006.06.27
VA.NET 7.1:
VA 4.1:
VAOpsWin.dll version 1.3.2.0
VATE.dll version 1.0.4.12
DevEnv.exe version 7.10.3077.0
msenv.dll version 7.10.3077.0
Font: Courier New 13(Pixels)
Comctl32.dll version 5.81.4916.400
WindowsNT 5.0 Build 2195 Service Pack 4
Single processor

Platform: Custom
Stable Includes:
c:\\program files\\microsoft visual studio .net 2003\\vc7\\include;
d:\\lib\\antlr\\antlr-2.7.4\\lib\\cpp;
d:\\lib\\boost\\boost_1_32_0\\boost;
d:\\lib\\libxslt\\libxslt-1.1.12+.win32\\include;
d:\\lib\\libxml2\\libxml2-2.6.17.win32\\include;
d:\\lib\\iconv\\iconv-1.9.1.win32\\include;
d:\\lib\\zlib\\zlib-1.2.1.win32\\include;
d:\\lib\\wtl\\wtl-7.5.5160\\include;
C:\\Program Files\\Microsoft Platform SDK\\Include;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\crt\\src\\;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\atlmfc\\include;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\PlatformSDK\\include\\prerelease;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\PlatformSDK\\include;
c:\\program files\\microsoft visual studio .net 2003\\sdk\\v1.1\\include;

Library Includes:
c:\\program files\\microsoft visual studio .net 2003\\vc7\\atlmfc\\src\\mfc;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\atlmfc\\src\\atl;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\crt\\src;

Other Includes:

studoot
Senior Member

35 Posts

Posted - Feb 08 2006 :  06:22:30 AM  Show Profile  Reply with Quote
I turned logging on - c:\\va.log appears to indicate an infinitely recursive template instantiation is being attempted in VAX - the following pattern repeats:

EDLck MakeTemplate::2046 2/8/2006 11:18:21 0x220
Creating instance of template :Visitor< int, R>
FD::MakeTemplate 0
(20 s)
Ready

I've uploaded a zip of the VAX logs to http://www.studoot.demon.co.uk/vax.zip

Also - the link in my previous message is incorrect because the forum code has included the full-stop at the end in the URL - it should be http://www.studoot.demon.co.uk/a.minimal.cpp
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Feb 08 2006 :  5:55:43 PM  Show Profile  Reply with Quote
*deeply puzzled expression*

i have downloaded and added your test cpp file to a C++ console application in VS2003. after adding the file to the "Source Files" folder in the solution i have scrolled up and down the file several times. while i did get some CPU spikes while doing this (which may have been caused by another process) i have not seen any prolonged CPU spikes. certainly nothing is using 100% of my CPU and not letting go.

so as a test i tried to compile this solution. with your test file included, but *every* single line commented out VS2003 is returning the error:

c:\\share\\code 2003\\a_minimal.cpp(136): fatal error C1010: unexpected end of file while looking for precompiled header directive

i even renamed the file to remove the extra dot, to see if that made any difference, but it did not.

opening the file i downloaded in VIM it is reporting the file format as UNIX, and nearly every line has a CTRL-M at the end, but not every line.

can you download the file and re test with this file please? i am wondering if something happened to the file its self. i do not understand why i am getting the compiler error i am getting, or why this CPU problem should be IDE specific.

i am getting exactly the same compiler error on two different machines, so that rules out a "simple" machine specific problem at this end.

it would be nice if i could reproduce this problem, especially given the time you put into creating such a small test case, thank you for that.

zen is the art of being at one with the two'ness
Go to Top of Page

studoot
Senior Member

35 Posts

Posted - Feb 08 2006 :  6:40:34 PM  Show Profile  Reply with Quote
OK - the C1010 is coming in because VS2003 defaults to 'Using precompiled headers'. I forgot I'd altered that to 'Not using precompiled headers' - sorry. Add a #include "stdafx.h" as the first line of the file.

I'll investigate further tomorrow at work - I haven't got a VS2003 handy here at home. Maybe it's something to do with my VC++ directory set? - possibly some interaction with parsed Boost libraries or something

BTW - I have had this problem on two different machines, so I have managed to reproduce it...

Do the log files indicate anything at all?
Go to Top of Page

studoot
Senior Member

35 Posts

Posted - Feb 09 2006 :  03:11:17 AM  Show Profile  Reply with Quote
OK - so my minimal example now doesn't lock up my Visual Studio - spikes over some constructs, but not constant 100% CPU time - go figure!

Anyway, I've constructed a new example which leaves the Visitor implementation in the Loki library header files. I've zipped up the whole solution (including the Loki include files) so there's no problems with precompiled headers or anything as before. It's at http://www.studoot.demon.co.uk/b.zip. Unzip, open the solution file (b.sln) in VS2003. In VS21003, open a.cpp, page to the bottom of file, it goes to 100% CPU for me.

I've removed any custom directories from my VAX setup, to remove that as a source of problems, so my VAX information is now as below



VA_X.dll file version 10.2.1440.0 built 2006.01.17
Licensed to:
VA X: [email protected] (1-user license) Support ends 2006.06.27
VA.NET 7.1:
VA 4.1:
VAOpsWin.dll version 1.3.2.0
VATE.dll version 1.0.4.12
DevEnv.exe version 7.10.3077.0
msenv.dll version 7.10.3077.0
Font: Courier New 13(Pixels)
Comctl32.dll version 5.81.4916.400
WindowsNT 5.0 Build 2195 Service Pack 4
Single processor

Platform: Win32
Stable Includes:
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\include;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\include;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\include\\prerelease;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\include;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\SDK\\v1.1\\include;

Library Includes:
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\src\\mfc;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\src\\atl;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\crt\\src;

Other Includes:

Go to Top of Page

studoot
Senior Member

35 Posts

Posted - Feb 09 2006 :  03:15:25 AM  Show Profile  Reply with Quote
PS - this example locks up VS2005 as well - I've just tried it.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Feb 09 2006 :  5:37:37 PM  Show Profile  Reply with Quote
confirmed, your second example goes wrong exactly as expected in VS2003. one interesting discovery, if i leave the IDE alone for 6 minutes then VA catches up and the CPU usage returns to normal, and everything seems fine after that, until i next restart the IDE. this is on a 3gig AMD with 1gig of RAM, so it is possible that your system with the full code would recover given long enough.

case=984

zen is the art of being at one with the two'ness
Go to Top of Page

studoot
Senior Member

35 Posts

Posted - Feb 09 2006 :  6:33:58 PM  Show Profile  Reply with Quote
Thanks - glad to know you've reproduced it.
Go to Top of Page

sac2dude
Starting Member

USA
1 Posts

Posted - Feb 13 2006 :  3:19:16 PM  Show Profile  Reply with Quote
I'm having this exact same problem, and its driving me nuts!

Visual Studio .NET 2003, VC++ project (unmanaged)

Just scrolling down the code... all of a sudden I get an hourglass... and I'm stuck.

The VAX startup.log file keeps growing, with the following lines:


EDLck MakeTemplate::2046 2/13/2006 12:17:18 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:18 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:19 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:19 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:19 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:19 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:19 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:19 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:20 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:20 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:20 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:20 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:20 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:20 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:21 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:22 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:22 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:22 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:22 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:22 0xdac
EDLck MakeTemplate::2046 2/13/2006 12:17:22 0xdac
....


Is there anything I can do to disable a feature in VAX to keep this from happening? Any ideas would be great. I'd hate to uninstall...

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Feb 13 2006 :  4:00:03 PM  Show Profile  Reply with Quote
there will be a bug fix for a problem with certain template code in the next release, which may help you. i am not certain when that is due though, but hopefully soon.

can you work around this problem by disabling VA while editing the problem files? or does this effect all files?

another possible solution is to try an earlier build, a version before 1418 may be more successful for you.

zen is the art of being at one with the two'ness
Go to Top of Page

studoot
Senior Member

35 Posts

Posted - Feb 13 2006 :  5:14:05 PM  Show Profile  Reply with Quote
feline - that's what I currently do - disable VAX, that is - I've got a keyboard shortcut for it now I don't think earlier versions will help - I've had this problem for a looong time - I've just been rather remiss about reporting it

I just miss my VAX....
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Mar 07 2006 :  6:40:41 PM  Show Profile  Reply with Quote
Templates in the Loki library no longer slow VA X in build 1442.
Go to Top of Page

studoot
Senior Member

35 Posts

Posted - Mar 08 2006 :  02:01:54 AM  Show Profile  Reply with Quote
Confirmed with my actual projects (i.e. not the minimal code I sent you). Thats great. Thank you!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000