Dependency hell과 빌드지옥 탈출
-
Upload
byeongsu-kang -
Category
Software
-
view
497 -
download
1
Transcript of Dependency hell과 빌드지옥 탈출
dependency hell kth 2
PC ? (== ?)debug 10 2~3
dll
dll dll ?
dll dll ?dll = dynamic linking library = (=) (=)
compileclass foo { private int _bar; private int *_pBar; private static int _s_bar1=7; private static int[100000000] _s_bar2;
public int foobar(value bar) { int local_bar=0; _pBar = malloc(10000000*sizeof(int)); } public static staticFoobar() { }}
compile ( )
.. -> ? ??
compileclass foo { private int _bar; private int *_pBar; private static int _s_bar1=7; private static int[100000000] _s_bar2;
public int foobar(value bar) { int local_bar=0; _pBar = malloc(10000000*sizeof(int)); } public static staticFoobar() { }}
sizeof(int) 4bytes compile time !!_s_bar1 4bytes_s_bar2 4*100000000bytes
compile time !! x = new foo(); memory
compile0000 0000 0000 0000 0000 0000 0000 00000000 0000 0000 0000 0000 0000 0000 0111
_s_bar1 4bytes0000 00f00000 00ff ( )
compile0000 0000 0000 0000 0000 0000 0000 00000000 0000 0000 0000 0000 0000 0000 0111???? ???? ???? ???? ???? ???? ???? ???? ???????? ???? ???? ???? ???? ???? ???? ???? ???????? ???? ???? ???? ???? ???? ???? ???? ???????? ???? ???? ???? ???? ???? ???? ???? ????
_s_bar1 4bytes ( )
_s_bar2 100Mbytes
100Mbytes ?0000 00f00000 00ff
compile0000 0000 0000 0000 0000 0000 0000 00000000 0000 0000 0000 0000 0000 0000 0111
_s_bar1 4bytes ( )_s_bar2
100Mbytes _s_bar2 . ???? ???? ???? ???? ???? ???? ???? ???? ????
0000 00f00000 00ff
compile0000 0000 0000 0000 0000 0000 0000 00000000 0000 0000 0000 0000 0000 0000 0111
_s_bar1 4bytes ( )_s_bar2 ???? ???? ???? ???? ???? ???? ???? ???? ????
0000 00f00000 00fffoo@foobar(value) foo@staticFoobar() class , method call
compiledata section ( )bss section0000 00f00000 00ffcode section
compile (= foo.o file )
link .. ?
link
foo.o
foo2.o+ +a+=executable image(= foo.exe foo.lib foo.dll)(xx.lib xx.dll)
link
foo.o
foo2.o
( ) offset foo.exe foo.lib foo.dlloffset ( )offset + 1offset + 2offset + 3
static link foo.exe foo.lib 400Mb
foo.lib
object file bss( )
static link
foo.lib
foo2.o+=
foo2.exe
foo.lib
foo3.o+=
foo3.exe
foo.lib ?
program size 400mb
program size 400mb
dynamic linkfoo.dll load . dll
foo2.o+=
foo2.exe
foo.dll
foo3.o+=
foo3.exe
foo.dll
foo.dll
runtimeclass foo { private int _bar; private int *_pBar; private static int _s_bar1=7; private static int[100000000] _s_bar2;
public int foobar(value bar) { int local_bar=0; _pBar = malloc(10000000*sizeof(int)); } public static staticFoobar() { }}
sizeof(int) 4bytes _pBar , 400mb memory .
local_bar , foobar()
runtimebssdatacodefoo.exe process stackheapstackheapnew foo() , malloc(xxx) foo->foobar() method call foobar() call stack local_bar foobar() ,(=return) local_bar
stack
dynamic linked library
heap
data
code
static linked library
Run time AreaDesign time Area
stack
dynamic linked library
heap
data
code
static linked library
Run time AreaDesign time Area
DLL
dll class foo { private int _bar; private int *_pBar; private static int _s_bar1=7; private static int[777777777] _s_bar2;
public int foobar(value bar) { int local_bar=0; _pBar = malloc(777777777*sizeof(int)); } public static staticFoobar() { }}
_s_bar2
_pBar foo.dll v2.0 / foo.dll v1.0
dll foo.dll system memory load memory load foo.dll v1.0foo.dll v2.0 foo3.exe !!!
foo2.exefoo.dll (v1.0)
foo3.exefoo.dll (v2.0)
system memoryfoo.dll (v1.0)
dll system directory dll case1 : system library case2 : system library
MS Windows shared library
winsock.dllc:\windows\system\msvcrt.dllwindows.dll.
dll main / library -> library ?-> .
linux shared library
libc.so/usr/liblibpthread.soglib.so.
libc.so/usr/local/liblibpthread.soglib.so.
jar program jar !! dll !!
java class path
/path/Afoo.jar (old)
/path/Bfoo.jar (new)
dependency ?PEBKAC(http://en.wikipedia.org/wiki/User_error)
library metadata / / build/package manager library virtual environment library
build/package managermavenbiicodepip / setuptoolsnpmyum / apt-get
virtual environmentvirtualenvdocker
Q & A ?