The first statement creates a variable called httpUtil
on the 'stack' - this means that, as soon as the function containing that line finishes, the variable goes 'out of scope' and gets released (the memory it uses becomes free to use for other stuff).
The second statement creates a variable on the 'heap' - this means that the variable will remain in memory until you call delete
on it. When allocating variables on the heap you need to make sure that you always delete
it at some point, otherwise you'll get memory leaks - this is where you can no longer see your *net
variable, but the memory is still allocated.