Re: [Cppcms-users] memory
Brought to you by:
artyom-beilis
From: Marcel H. <ke...@co...> - 2015-11-13 08:03:55
|
On 13.11.2015 04:18, mawan sugiyanto wrote: > void users::loadimage(std::string sid){ > int width, height; stack, stack > Image image("../profile_images/default.png"); stack > Geometry gtx(200,200); stack > Blob b; stack Everything is allocated on the stack, as long as you don't allocate it via new (or {c,a}malloc) > is image variable allocated on stack or in new memory? it is called heap, not new memory. > and i can not delete image variable like unset variable? All your variables will be deleted, when the programm flow "reaches" that last } . Your only way to force to unset a variable is to begin a new scope > void foo() { > int f; > { > int g = 3; > f = g; > } > return f; > } g is only valid in the scope it was declared in. You cannot reach it, outside of the scope. Greetings |