Got memory pressure notification (critical/non-critical) - iOS objetive-c











up vote
0
down vote

favorite












Got memory pressure notification (critical/non-critical).



“n” numbers of images loading from API in tableview. But the app is crashing with above mentioned error after few seconds.
The current code is,



[post_img sd_setImageWithURL:[NSURL URLWithString:[arr objectAtIndex:i]] placeholderImage:[UIImage imageNamed:@"placeHolder.jpg"] options:SDWebImageRefreshCached];


I tried remove cache,



[[SDImageCache sharedImageCache] removeImageForKey:[arr objectAtIndex:i] fromDisk:YES withCompletion:nil];


Also, I tried to fetch images using dispatchqueue,



dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: [arr objectAtIndex:i]]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
post_img.image = [UIImage imageWithData: data];
});
});


But still I getting the error.










share|improve this question






















  • I think you are testing on some old device. Get rid of that and test on newer one. Also store smaller size image on your server.
    – rptwsthi
    14 hours ago










  • three things will happen here 1. may be your image weight is high, 2. your app memory high 3. your device memory is low.
    – Anbu.karthik
    14 hours ago















up vote
0
down vote

favorite












Got memory pressure notification (critical/non-critical).



“n” numbers of images loading from API in tableview. But the app is crashing with above mentioned error after few seconds.
The current code is,



[post_img sd_setImageWithURL:[NSURL URLWithString:[arr objectAtIndex:i]] placeholderImage:[UIImage imageNamed:@"placeHolder.jpg"] options:SDWebImageRefreshCached];


I tried remove cache,



[[SDImageCache sharedImageCache] removeImageForKey:[arr objectAtIndex:i] fromDisk:YES withCompletion:nil];


Also, I tried to fetch images using dispatchqueue,



dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: [arr objectAtIndex:i]]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
post_img.image = [UIImage imageWithData: data];
});
});


But still I getting the error.










share|improve this question






















  • I think you are testing on some old device. Get rid of that and test on newer one. Also store smaller size image on your server.
    – rptwsthi
    14 hours ago










  • three things will happen here 1. may be your image weight is high, 2. your app memory high 3. your device memory is low.
    – Anbu.karthik
    14 hours ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Got memory pressure notification (critical/non-critical).



“n” numbers of images loading from API in tableview. But the app is crashing with above mentioned error after few seconds.
The current code is,



[post_img sd_setImageWithURL:[NSURL URLWithString:[arr objectAtIndex:i]] placeholderImage:[UIImage imageNamed:@"placeHolder.jpg"] options:SDWebImageRefreshCached];


I tried remove cache,



[[SDImageCache sharedImageCache] removeImageForKey:[arr objectAtIndex:i] fromDisk:YES withCompletion:nil];


Also, I tried to fetch images using dispatchqueue,



dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: [arr objectAtIndex:i]]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
post_img.image = [UIImage imageWithData: data];
});
});


But still I getting the error.










share|improve this question













Got memory pressure notification (critical/non-critical).



“n” numbers of images loading from API in tableview. But the app is crashing with above mentioned error after few seconds.
The current code is,



[post_img sd_setImageWithURL:[NSURL URLWithString:[arr objectAtIndex:i]] placeholderImage:[UIImage imageNamed:@"placeHolder.jpg"] options:SDWebImageRefreshCached];


I tried remove cache,



[[SDImageCache sharedImageCache] removeImageForKey:[arr objectAtIndex:i] fromDisk:YES withCompletion:nil];


Also, I tried to fetch images using dispatchqueue,



dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: [arr objectAtIndex:i]]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
post_img.image = [UIImage imageWithData: data];
});
});


But still I getting the error.







ios objective-c image sdwebimage






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 14 hours ago









john raja

513




513












  • I think you are testing on some old device. Get rid of that and test on newer one. Also store smaller size image on your server.
    – rptwsthi
    14 hours ago










  • three things will happen here 1. may be your image weight is high, 2. your app memory high 3. your device memory is low.
    – Anbu.karthik
    14 hours ago


















  • I think you are testing on some old device. Get rid of that and test on newer one. Also store smaller size image on your server.
    – rptwsthi
    14 hours ago










  • three things will happen here 1. may be your image weight is high, 2. your app memory high 3. your device memory is low.
    – Anbu.karthik
    14 hours ago
















I think you are testing on some old device. Get rid of that and test on newer one. Also store smaller size image on your server.
– rptwsthi
14 hours ago




I think you are testing on some old device. Get rid of that and test on newer one. Also store smaller size image on your server.
– rptwsthi
14 hours ago












three things will happen here 1. may be your image weight is high, 2. your app memory high 3. your device memory is low.
– Anbu.karthik
14 hours ago




three things will happen here 1. may be your image weight is high, 2. your app memory high 3. your device memory is low.
– Anbu.karthik
14 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371939%2fgot-memory-pressure-notification-critical-non-critical-ios-objetive-c%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371939%2fgot-memory-pressure-notification-critical-non-critical-ios-objetive-c%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]