[Issue 5219] @noheap annotation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 18 12:41:56 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5219



--- Comment #4 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> 2010-11-18 12:40:40 PST ---
(In reply to comment #1)
> No.
> Use a profiler.

I compiled this code with profiler
---
class A
{
    int delegate() a;
}

A f()
{
    int a=1;
    int g()
    {
        a+=3;
        return a;
    }
    A b=new A();
    b.a=&g;
    a+=2;
    return b;
}

int main()
{
    assert(f().a()==6);
    return 0;
}
---

It gave me this output:
------------------
        1    __Dmain
_D4test1fFZC4test1A    1    7801    7801
------------------
        1    __Dmain
_D4test1fFZC4test1A1gMFZi    1    16    16
------------------
__Dmain    0    9139    1322
        1    _D4test1fFZC4test1A
        1    _D4test1fFZC4test1A1gMFZi

======== Timer Is 2000320000 Ticks/Sec, Times are in Microsecs ========

  Num          Tree        Func        Per
  Calls        Time        Time        Call

      1           3           3           3     _D4test1fFZC4test1A
      1           4           0           0     __Dmain
      1           0           0           0     _D4test1fFZC4test1A1gMFZi
---
How can I tell whether the code calls heap allocation functions?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list