N
Nephi Immortal
Can you please be kind to answer my question? I know that it is not C+
+ topic on this newsgroups. I did a lot of researches, but I did not
find valuable information.
First question:
After you allocate memory using new function, you accidently call
delete function twice. It causes to have memory leak. The C++
program exit main function before it calls EndProcess function
(probably Win32 API). Can EndProcess deallocate some objects and
memory leaks automatically? Memory leaks will not affect another
applications or resources.
Sometimes, terminate function or abort function do not release some
allocated objects can cause memory leaks prior EndProcess. The client
will require to reboot operating system to clear up all available
memory.
Please confirm if I am correct.
Second question:
When you create free heap object, how many bytes do free heap object
take allocated memory before you use new function to allocate small or
large array.
For example, you allocate 16 bytes. Heap reserves extra 8 bytes.
One is for array pointer and another one is for heap pointer.
Perhaps, extra 16 bytes.
You can allocate multiple 16-byte arrays or 256 16-byte arrays. The
total 256 16-byte arrays is 4,096 bytes. Heap object might reserve
extra 2,048 bytes for all 256 16-byte arrays.
I am interested to know more. If you have information, please
provide me website.
+ topic on this newsgroups. I did a lot of researches, but I did not
find valuable information.
First question:
After you allocate memory using new function, you accidently call
delete function twice. It causes to have memory leak. The C++
program exit main function before it calls EndProcess function
(probably Win32 API). Can EndProcess deallocate some objects and
memory leaks automatically? Memory leaks will not affect another
applications or resources.
Sometimes, terminate function or abort function do not release some
allocated objects can cause memory leaks prior EndProcess. The client
will require to reboot operating system to clear up all available
memory.
Please confirm if I am correct.
Second question:
When you create free heap object, how many bytes do free heap object
take allocated memory before you use new function to allocate small or
large array.
For example, you allocate 16 bytes. Heap reserves extra 8 bytes.
One is for array pointer and another one is for heap pointer.
Perhaps, extra 16 bytes.
You can allocate multiple 16-byte arrays or 256 16-byte arrays. The
total 256 16-byte arrays is 4,096 bytes. Heap object might reserve
extra 2,048 bytes for all 256 16-byte arrays.
I am interested to know more. If you have information, please
provide me website.