Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
New Developer
Posts: 55
Registered: ‎04-04-2012
My Device: Z30, Z10LE, Q5 & PlayBook
My Carrier: German Provider
Accepted Solution

QDir.entryInfoList() -> std::bad_alloc!

Hi all!

 

For my app PhotoUploader I need to check all existing photos in the camera folder(s) of the device. It works like a charme for everyone not having more than roughly thousand files in that folder, but for those who have, I'm unable to read that directory... 

 

It's a long-running headless application and the following code is used inside a thread of the service:

 

QDir dir(path); // /accounts/1000/shared/camera
QFileInfoList result = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::Readable, QDir::Time | QDir::Reversed);

This always crashes on my devices (Z30 & Dev C) with a big amount of files in that directory. I've put a try-catch around and it always throws a "std::bad_alloc" exception when it crashes... I've already tried to switch to dir.entryList(...) but that does not make any difference at all.

 

Any help would be greatly appreciated!

 

Best,

Sven

---
Developer ReadItNow!, PhotoUpload, WhereIs...?, Magic4Square and OrganizeMe!

http://sven-ziegler.com
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: QDir.entryInfoList() -> std::bad_alloc!

This could be related to this problem here...

 

http://supportforums.blackberry.com/t5/Native-Development/count-number-of-files-in-a-directory/m-p/2...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
Posts: 55
Registered: ‎04-04-2012
My Device: Z30, Z10LE, Q5 & PlayBook
My Carrier: German Provider

Re: QDir.entryInfoList() -> std::bad_alloc!

Looks like you're right. Thanks for your help! Smiley Happy

Even if that's not the kind of solution I was seeking for, and imo it's a shame that this issue is well known and documented for over a year now, without anything changed until today.

Best,
Sven
---
Developer ReadItNow!, PhotoUpload, WhereIs...?, Magic4Square and OrganizeMe!

http://sven-ziegler.com