If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Connect to lowMemory signal

[ Edited ]

I'm having issues connecting to this signal. The documentation hasn't helped me resolve my issue. Here's what I have.

 

My SLOT is never called. However, I receive memory warnings from the console, as the debugger seems to automatically print them, ie:

 

Process 145588425 received low memory signal, priority = 2
Process 145588425 received low memory signal, priority = 2

I don't receive an error that either my SIGNAL or SLOT does not exist, which is usually the issue when I have problems with SLOTS not being called.

 

app.hpp

#include <bb/MemoryInfo>
#include <bb/LowMemoryWarningLevel>

public slots:
	//Memory
	void onLowMemory(bb::LowMemoryWarningLevel::Type);

app.cpp

App::App() {
	//CONNECT TO MEMORY WARNINGS
	bb::MemoryInfo memoryInfo;
	QObject::connect(&memoryInfo, SIGNAL( lowMemory(bb::LowMemoryWarningLevel::Type) ),
		this, SLOT( onLowMemory(bb::LowMemoryWarningLevel::Type) ));
}

void App::onLowMemory(bb::LowMemoryWarningLevel::Type level) {
	qDebug() << "Low memory";
    if (level == bb::LowMemoryWarningLevel::LowPriority) {
    	qDebug() << "Low priority memory warning.";
    	//releaseLowPriorityMemory();
    } else if (level == bb::LowMemoryWarningLevel::HighPriority) {
    	qDebug() << "High priority memory warning.";
        //releaseHighPriorityMemory();
    }
}

 

Probably worth noting the application compiles and runs, so I have incldued -lbb in the .pro, and seem to have covered all the preconditions.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.
Developer
StevenKader
Posts: 635
Registered: ‎02-03-2010
My Device: Z10 LE
My Carrier: Rogers

Re: Connect to lowMemory signal

Only difference I see from this sample is that you have 'this' for slot and they have &testObject. 

 

  bb::Application app(argc, argv);
    bb::MemoryInfo memoryInfo;
    TestObject testObject;
 
    QObject::connect(&memoryInfo, SIGNAL( lowMemory(bb::LowMemoryWarningLevel::Type) ),
                     &testObject, SLOT( onLowMemory(bb::LowMemoryWarningLevel::Type) ));

 


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Please use plain text.
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Connect to lowMemory signal

Yeah, I have no idea why they're doing that. Maybe you HAVE to handle the warning in another object, for some reason. I guess I could try that.
----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.