Link to home
Start Free TrialLog in
Avatar of pisselou
pisselou

asked on

heap->stack

Hi,
How should you change this heap-allocation-code to stack-allocation-code ??
      textel->length = 15* sizeof(int16);
      textel->buffer = new int16[textel->length];
Thanks in advance.

ASKER CERTIFIED SOLUTION
Avatar of grg99
grg99

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pisselou
pisselou

ASKER

Hi, I got code which worked, but when I looked with the task manager I clearly had a memory leak (memory raised till it crashed). Now it works fine, and
1) without memory leak
2) I don't have to think about placing the delete
3)maybe faster, since it's on the stack

So, thanks a lot.