haifeng.qin@wellintech.com via llvm-dev
2016-Dec-15 07:26 UTC
[llvm-dev] How to actively reclaim stack memory
For help: for loop lead to stack overflow, want to actively reclaim stack memory of alloc instruction. How to actively reclaim stack memory ? haifeng.qin at wellintech.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161215/54b3b18c/attachment.html>
David Chisnall via llvm-dev
2016-Dec-15 10:01 UTC
[llvm-dev] How to actively reclaim stack memory
On 15 Dec 2016, at 07:26, haifeng.qin at wellintech.com via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > For help: > > for loop lead to stack overflow, want to actively reclaim stack memory of alloc instruction. > > How to actively reclaim stack memory ?This sounds as if you’re putting the alloca inside the loop, not in the entry basic block and reusing it. If you need the same amount of storage for each loop iteration, then you should put the alloca in the entry basic block and use the lifetime start / stop intrinsics in the loop to mark reuse of the memory. If you need different sized allocations, then you will need to use the stack save and stack restore intrinsics inside the loop to reset the stack allocations in the loop. David
haifeng.qin@wellintech.com via llvm-dev
2016-Dec-16 01:19 UTC
[llvm-dev] How to actively reclaim stack memory
Thanks very much for your help! Qin haifeng.qin at wellintech.com From: David Chisnall Date: 2016-12-15 18:01 To: haifeng.qin at wellintech.com CC: llvm-dev Subject: Re: [llvm-dev] How to actively reclaim stack memory On 15 Dec 2016, at 07:26, haifeng.qin at wellintech.com via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > For help: > > for loop lead to stack overflow, want to actively reclaim stack memory of alloc instruction. > > How to actively reclaim stack memory ?This sounds as if you’re putting the alloca inside the loop, not in the entry basic block and reusing it. If you need the same amount of storage for each loop iteration, then you should put the alloca in the entry basic block and use the lifetime start / stop intrinsics in the loop to mark reuse of the memory. If you need different sized allocations, then you will need to use the stack save and stack restore intrinsics inside the loop to reset the stack allocations in the loop. David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161216/e0ad6d2e/attachment.html>
Seemingly Similar Threads
- How to actively reclaim stack memory
- How to catch EXCEPTION_ACCESS_VIOLATION exceptions on win64
- How to catch EXCEPTION_ACCESS_VIOLATION exceptions on win64
- Lockd: failed to reclaim lock for pid ...
- Firefox and Thunderbird freeze/crash followed by "nfs4_reclaim_open_state: Lock reclaim failed!" syslog messages