ked
BAN USERData over network means data coming on socket created. When the data arrives there is a kernel space buffer allocated to it. Sending a pointer of char type from user space wont do the job. As we can not access kernel space buffers from user space directly, we need to pass the user space memory to the call which returns the network data.
With regards to size of data, the underlying n/w protocol has a fixed packet size decided while performing a hand shake. So we can use that to allocate the maximum size for our user space buffer.
declaring global variable is accessible to other files
declaring static global variables scope is restricted to that file as global.
static within function : access to that variable is from inside the function and variable value does not change even when program goes out of scope of that function.
local variables: saved on stack so whenever function ends, it is popped.
memory leaks happen for running servers/processes. Whenever a process ends, its address space and allocated memory for it is freed. Say a server process is running, usually it forks other server process to interact with clients. in case every process is having a memory leak, then finally we need to kill the parent process, in order to free up the resources.
You can confirm this on windows using task manager and on linux using top command.
When we inherit a class, a copy of object of parent class is kept inside the child. On the same line if we inherit a class from two parents, it will have copies of both parents.
Now when we say aa=&c; aa is a pointer of type A so it will point to the copy of A present in C, similarly thing will hold true for B and hence both will point to diff addresses
we can not have references to pointer, this is standard C++ rule defined. Program wont compile
- ked February 28, 2008