I created an executable using static library instead shared lib, I am running multipe instances of this executable, does it takes more memory with static library compare to shared library?.
Does shared library had any advantage than static library in multiple instances?. thanks in advance
4 4375 Banfa 9,065
Expert Mod 8TB
With a static library all the code is in the program. With a shared library the OS loads the library code separately, no matter how many programs are using the library only 1 instance of the library code is loaded.
So yes running several instances of a program linked with a static library as opposed to a shared library will use more memory. The real question though is it significant. If you static library is only a few kbytes in size then it probably makes little difference, if your program creates large amounts of actual data, which is unaffected by the code being in a static or shared library then it is likely that the memory used for data far out-weighs the memory used for code and again it may be insignificant.
It also depends on what operating system your program executes under. Some operating systems deal with multiple instances of the same executable by loading only a single copy of the text section and per-instance copies of the bss and data sections.
Under such an operating system, multiple instances of the same program show no benefit of shared library over static library. Instead, you don't see the advantage until you have two different programs that both include the same portions of a shared library.
I created an executable by linking Nine static libraries, I am running 32 instances of this execuatble in Linux, how I will know whether it is using single copy of text sectioon or multiple of copies, Is there any command in Linux (RH)?. I created Nice shared libs also, but when I created executable using shared libs, it is not working, I have to debug whe my shared libs exe file not working, where as static libs linked exe file works.
I created 9 static libs (x1.a x2.a x3.a....x9.a) and 9 shared libs (y1.so, y2.so,....y9.so) when linking with static libs everything looks ok, but when linking with shared libs, it is not working), for final linking I am using -static when linking with static libs, where as I am not using any flag when linking with shared libs, do I have to use any other flag with shared libs?.
1) this command to create final exe file using static libs
gcc -static -Wall -g -O2 xyz1.o xyz2.o xyz3.o -L/opt/lib -lx1 -lx2 -lx3 ... -lx9 -ldl -lpthread -lm -lstdc++ -o final-exe-file
2) this command to create final exe file using shared libs
gcc -Wall -g -O2 xyz1.o xyz2.o xyz3.o -L/opt/lib -ly1 -ly2 -ly3.... -ly9 -ldl -lpthread -lm -lstdc++ -o final-exe-file
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ohaya |
last post by:
Hi,
I'm trying to understand a situation where ASP seems to be "blocking" of
"queuing" requests. This is on a Win2K Advanced Server, with IIS5.
I've seen some posts (e.g.,...
|
by: Mike |
last post by:
Looking to find any information on how to properly configure multiple
instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking
for information on how the multiple instance settings...
|
by: Abhishek Srivastava |
last post by:
Hello All,
In IIS 6.0 We have a concept of worker processes and application pools.
As I understand it, we can have multiple worker process per appliction
pool. Each worker process is dedicated...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
|
by: Olie |
last post by:
This post is realy to get some opinions on the best way of getting fast
comunication between multiple applications. I have scowered the web for
imformation on this subject and have just found...
|
by: John |
last post by:
Does the length of my C variable names have any affect, performance-wise, on
my final executable program? I mean, once compiled, etc., is there any
difference between these two:
number = 3;
n =...
|
by: Mike |
last post by:
Class A
public objX
I want to create 2 or more instances of Class A and have the same value for
objX in all instances.
Instance1 of Class A
Instance2 of Class A
Instance3 of Class A
|
by: =?Utf-8?B?VG9kZA==?= |
last post by:
What is the memory footprint of static methods of a windows app running on a
server when the server spins up multiple instances of the application?
In my envirionment, we have a Citrix server...
|
by: Nethali |
last post by:
Hi folks,
Is there any way to embed shared library directly, to executable file
it self so that executable file can run stand alone without the shared
library.
I don't want to compile the...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |