Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6852973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:27:20+00:00 2026-05-27T01:27:20+00:00

When i run profile with this code in Instruments, I got 35 memory leaks

  • 0

When i run profile with this code in Instruments, I got 35 memory leaks of Player. How i need to handle to avoid memory leaks?

NSMutableArray *players = [NSMutableArray array];
NSData *data = [theRequest responseData];
NSArray *array = (NSArray *) [decoder objectWithData:data];
int len = 35;
for (int i = 0; i < len; i++) {
    NSDictionary *dic = (NSDictionary *) [array objectAtIndex:i];

    Player *p = [[Player alloc] init];
    p.playerID = [dic objectForKey:@"id"];
    p.name = [dic objectForKey:@"name"];
    p.country = [dic objectForKey:@"country"];
    p.club = [dic objectForKey:@"club"];
    p.imageURL = [dic objectForKey:@"image"];
    p.likeNumber = [dic objectForKey:@"like_number"];
    p.likeTime = [dic objectForKey:@"like_time"];
    p.likePlayerID = [dic objectForKey:@"like_player_id"];
    p.likeDeviceID = [dic objectForKey:@"like_device_id"];
    p.disLikeNumber = [dic objectForKey:@"dislike_number"];
    p.disLikeTime = [dic objectForKey:@"dislike_time"];
    p.disLikePlayerID = [dic objectForKey:@"dislike_player_id"];
    p.disLikeDeviceID = [dic objectForKey:@"dislike_device_id"];

    [players insertObject:p atIndex:i];
    [p release];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:27:21+00:00Added an answer on May 27, 2026 at 1:27 am

    Perhaps it thinks your players pointer is being lost at the end of the code block.

    Or perhaps it is getting confused over the status of the array.

    Does it complain if you create the mutable array with alloc-init instead of array: ? (Using ‘array’ without a retain does leave the whole thing on the allocation pool.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is a weird one, when I run the following code all rows are
I'd like to statistically profile my C code at the instruction level. I need
When profiling my app with Instruments (looking for memory leaks), I get extremely different
when i use this code,the jquery code in the #paylasimlar does not run.i search
If I run Profiler, then it suggests a lot of indexes like this one
The default the profile file is from the executable is run and the file
I wrote some code to detect a users proxy information. This works when I
In my views.py I have something like this: a = Profile.objects.get(user=request.user.id) a.avatar = avatar.id
I am a beginner just starting to profile my code and was confused why
I have this code: $(document).ready(function() { var url = https://graph.facebook.com/search?q=cinema&type=post; $.ajax({ type: POST, url:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.