Thread: Dynamic Linking & Memory usage

  1. #1
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591

    Dynamic Linking & Memory usage

    I'm wondering if there is a signficant advantage to using dynamic link libraries to reduce the memory footprint of a program? So far I have about 10-12 functions I only call very rarely that are approximately 3500 lines of code combined, and I need to know if it is worth putting this into a DLL to reduce the program's size in memory. I know that DLLs will definately decrease the size of the binary file itself, but would like to know the effect of dynamic linking on a programs memory usage (i.e. will calling the dynamic linking function take up more time/memory than had I just included it into the binary file in the first place?)

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    It'll take more time and more space. Probably not much more, but it won't be less.

    Dynamic linking is for if you want some set of functions that are easily replacable, or shared between more than one executable. Programming libraries are usually DLLs since they have a separate programmer(s), and can then (hopefully) be updated by just replacing the DLL. (That, and license restrictions sometimes prevent static linking.) The other use for DLLs is plugins. (All of WinAmp's plugins are DLLs, for example.)
    If the code in question is used only by one executable, then there's probably not much point in a DLL.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    Ok thanks, that's what I needed to know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why use Dynamic Memory
    By appleGuy in forum C++ Programming
    Replies: 11
    Last Post: 08-28-2006, 02:46 PM
  2. Dynamic memory allocation...
    By dicorr in forum C Programming
    Replies: 1
    Last Post: 06-24-2006, 03:59 AM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Pointer's
    By xlordt in forum C Programming
    Replies: 13
    Last Post: 10-14-2003, 02:15 PM
  5. dynamic memory + linked lists
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 02-10-2002, 04:50 PM