V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
diwup
V2EX  ›  问与答

模拟内存泄露 #Xcode #iOS

  •  
  •   diwup · Dec 16, 2010 · 5759 views
    This topic created in 5615 days ago, the information mentioned may be changed or developed.
    我用这么一段代码模拟内存泄露:

    int i = rand();
    NSMutableString *leak = [[NSMutableString alloc] initWithFormat:@"%d+qwerty", i];
    leak = nil;

    但是无论怎么运行,Xcode的Leaks小工具,就是不报泄露。(如图, http://d.pr/NKbF

    求助,请问我错在哪里。。?
    2 replies    1970-01-01 08:00:00 +08:00
    dc
        1
    dc  
       Dec 16, 2010 via iPhone
    Alloc 后必须 release 释放。
    overboming
        2
    overboming  
       Dec 16, 2010
    Check Manually 呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2401 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:09 · PVG 10:09 · LAX 19:09 · JFK 22:09
    ♥ Do have faith in what you're doing.