Memory leak in search query Android SDK

I am using the Android SDK and there seems to be a memory leak when making a search query.

Here is the code used:

whereClause = "channelId like 'ChannelIdHere' AND created > 20140116125012";
 
updateQuery.setWhereClause(whereClause);
updateQuery.setQueryOptions(new QueryOptions( "created ASC"));
 
       Backendless.Persistence.of(ChatActivity.class).find(updateQuery, new AsyncCallback<BackendlessCollection<ChatActivity>>() {
              @Override
              public void handleResponse(BackendlessCollection<ChatActivity> chatActivities) {
                 
              }
                    
              @Override
              public void handleFault(BackendlessFault fault) {
              }
       });

When running the above code the memory use increases by about 300kb and it is never released. I am using it for refreshing a feed and it runs every second (although I’ve tried reducing the frequency and the end result is the same). Therefore the memory rise is quite fast. Eventually I get the following error which seems to be a system error:

01-16 14:10:28.646: A/libc(16920): Fatal signal 11 (SIGSEGV) at 0x00000030 (code=1), thread 17035 (Thread-16519)

I have tried running this on different devices with the same result. The exact “where” clause does not seem to matter.

Any advice would be helpful.

I’m getting the exact same error now:

A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x71470900 in tid 19249 (ftcards.rewards)

I cannot start my app at all. it happens every time!!

I have the same problem. With each call of find() function, allocated memory is increased and don’t cleared by GC. So, using this SDK I can’t control memory as I want and OutOfMemory errors are unavoidable.

Hi Alex,
Do you use asynchronous find?
Artur

Hi Artur,
I’ve tried both. Just created onClickListener and set it for some view like this:

toolbar.setNavigationOnClickListener(v -> {
 BackendlessDataQuery query = new BackendlessDataQuery();
 Backendless.Data.of("FriendsRelate").find(query, 
 new AsyncCallback<BackendlessCollection<Map>>() {
 @Override
 public void handleResponse(BackendlessCollection<Map> mapBackendlessCollection){
 Log.e("TAG","Succeed: " + mapBackendlessCollection.getCurrentPage().size());
 }
 @Override
 public void handleFault(BackendlessFault backendlessFault) {
 Log.e("TAG", "Failure: " + backendlessFault.getMessage());
 }
 });
});

In this case, after few clicks, I got next result on my Memory monitor:
http://support.backendless.com/public/attachments/9e81a181af871353445f3bf86c006851.png</img>
As you can see, between ~7s and ~40s I’ve initiated clicks with my view and sent queries via backendless sdk.
When I use sync find I have similar result, however in this case my memory increases from 10MB to 14MB (instead 10-26MB in async example).
There is my sync implementation:

toolbar.setNavigationOnClickListener(v -> {
 BackendlessDataQuery query = new BackendlessDataQuery();
 new AsyncTask<Void, Void, Void>() {
 @Override
 protected Void doInBackground(Void... voids) {
 Backendless.Data.of("FriendsRelate").find(query);
 return null;
 }}.execute();
 });
 
 
 
 
 
 
 
 
 
 
 
 


Does it mean that problem in backendless android sdk or I do something wrong?

UPD: sorry for disgusting format of code example, I can’t use spaces or tabs in this editor :frowning: