Compiled Home Pages




CHP has 2 heaps. There's the standard heap that C++ has and a CHP garbage collected heap.
Differences between heaps
Standard C++ heapCHP garbage collected heap
Constructor:int *$test = new int();int *$test = (int*)dll_malloc_temp(Context,sizeof(int));
Some objects have a static Create method.
Destructor:delete $test;dll_free_temp(Context,(void *)$test);
Some objects have a Dispose method.
Lifetime:Objects exist until deleted. static pointers retain their values between web page calls(sometimes). Objects are deleted when the web page closes.
Requirements:Can be used anywhere.Requires a Context pointer.
The speed advantage is that with the CHP garbage collected heap is that when the web page is finished, the entire heap is reclaimed/destroyed.
The mysql_list command can use the context to store a list of data on the CHP heap. When you're done with the list, you can use the Chop() method on the list to delete the contents of the list without freeing each one. The Chop() command creates a memory leak when the list is on the CHP garbage collected heap. But this memory leak is fixed when the page is finished rendering. The CHP garbage collected heap is cleaned when all the pages are done rendering. This matters when pages call other pages.
The speed advantage of the CHP garbage collected heap is that there is no garbage collector running in the background line in C#.
Static pointers created on the standard C++ heap retain their values between web page calls with the following exceptions:
1. NGINX sometimes creates multiple child processes to take advantage of computers with multiple cpu cores.
2. When a new version of a DLL or shared library is put out for a web page, NGINX unloads the old DLL and reloads the new DLL.