473,320 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Linking takes upto an hour

My C++ project takes 45-60 minutes for linking, with link.exe taking up 100%
of the CPU.

I am using:
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)

Microsoft Visual C++ 2005 77626-009-0000007-41789
Microsoft Visual C++ 2005

The same code links with gcc and SunStudio compilers in less than 30
seconds.

I have enabled incremental linking for the project.

Here is the link time log:
Linking...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
Creating library C:\Ram\prj\prj.lib and object C:\Ram\prj\prj.exp
LibDef: Total time = 0.000s
Generating code
Finished generating code
OptRef: Total time = 0.000s
OptIcf: Total time = 0.063s
Pass 1: Interval #1, time = 1548.766s
Pass 2: Interval #2, time = 3.640s
Final: Total time = 1552.406s
Embedding manifest...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
Creating library C:\Ram\prj\prj.lib and object C:\Ram\prj\prj.exp
LibDef: Total time = 0.016s
Generating code
Finished generating code
OptRef: Total time = 0.000s
OptIcf: Total time = 0.047s
Pass 1: Interval #1, time = 2013.203s
Pass 2: Interval #2, time = 1.297s
Final: Total time = 2014.500s
I do know which piece of code is triggering it - I am allocating a 20,000
byte buffer on the stack in a particular function:
void function() {
...
BYTE ba[] = { (BYTE) 0x11, (BYTE) 0x42, ... ... ... };
...
}
If I #ifdef this code out, the link times return to less than a minute.

Any suggestions ?

Thanks,
RS
Nov 29 '07 #1
4 1272

I do know which piece of code is triggering it - I am allocating a 20,000
byte buffer on the stack in a particular function:
void function() {
...
BYTE ba[] = { (BYTE) 0x11, (BYTE) 0x42, ... ... ... };
...
}
If I #ifdef this code out, the link times return to less than a minute.

Any suggestions ?
Yeah, put that function in a separate library without /LTCG so it never gets
recompiled.
>
Thanks,
RS


Nov 29 '07 #2
Ben Voigt [C++ MVP] wrote:
>I do know which piece of code is triggering it - I am allocating a
20,000 byte buffer on the stack in a particular function:
void function() {
...
BYTE ba[] = { (BYTE) 0x11, (BYTE) 0x42, ... ... ... };
...
}
If I #ifdef this code out, the link times return to less than a
minute. Any suggestions ?

Yeah, put that function in a separate library without /LTCG so it
never gets recompiled.
But /LTCG is a linker command, the OP need the compiler equivalent: Put that
function in a separate compiland and compile it with /GL- to inhibit link
time code generation for that module.

-cd
Nov 30 '07 #3
Ram Shriram wrote:
I do know which piece of code is triggering it - I am allocating a 20,000
byte buffer on the stack [...]
Setting aside the linking issue, I can't help but wonder why on earth
you would want to allocate such a huge buffer on the stack? I cannot
think of any sane reason.

If you don't need to modify the buffer, then why not simply declare it
static const?

If you do need to modify the buffer, then why not declare a single
static const copy of the buffer, and then dynamically allocate a chunk
of memory when needed, and memcpy the contents of the static buffer into
it, use it and then release it.

-n
Dec 5 '07 #4
Ram Shriram wrote:
I do know which piece of code is triggering it - I am allocating a 20,000
byte buffer on the stack [...]
Setting aside the linking issue, I can't help but wonder why on earth
you would want to allocate such a huge buffer on the stack? I cannot
think of any sane reason.

If you don't need to modify the buffer, then why not simply declare it
static const?

If you do need to modify the buffer, then why not declare a single
static const copy of the buffer, and then dynamically allocate a chunk
of memory when needed, and memcpy the contents of the static buffer into
it, use it and then release it.

-n
Dec 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tony Williams | last post by:
I have two tables one lists the names of committees and the other is a list of documents they generate. I have a form based on the documents table which gives details of the document including...
18
by: Mark P | last post by:
I have a bit of vb code that uses Tables.Append to programatically link tables from Oracle and DB2 datasources. The problem I am having on some client machines is that the link will take anywhere...
4
by: Timothy Golden | last post by:
Can anyone tell me what goes on beneath the hood with table linking in Access? We have a speed issue with our database. It uses access for the front end and the back end. Prior to splitting the...
4
by: Sam | last post by:
Service properties ------------------ Log On As: LocalSystem Logon account has full admin privileges. OnStart() routine ----------------- { EventLog->WriteEntry ("Commencing..."); .... A
1
by: Markus Neff | last post by:
Dear MS VS .NET 2003 users, so far I used MS VS 6.0 SP5 for a rather large C++ project. Now I want to migrate to MS VS .NET 2003. First tests however showed that compilation and most notably...
7
by: wmkew | last post by:
Hello everyone I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with...
6
by: Rudy Ray Moore | last post by:
I work with a multi-project workspace. One project (the "startup" project) has a "Configuration Type" of "Application (.exe)". The other 40 projects have a "Configuration Type" of "Static Library...
0
by: Rudy Ray Moore | last post by:
I've been having trouble getting incremental linking to work under Visual C++ .net 2003 7.1 for my multi-project workspace. Ronald Laeremans and Carl Daniel (and a few others) helped me figure it...
5
by: ikshefem | last post by:
I often need to re-code for myself a small code snippet to define string.upto() and string.from(), which are used like : # canonical examples > "1234456789".upto("45") '1234' >...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.