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
Contributor
Posts: 22
Registered: ‎02-02-2012
My Device: none
My Carrier: none

Malloc Check Failed while porting Qt app

I've written small network application in Qt with an extensive part written in plain C. I am also using OpenSSL library. This application works pretty fine in Linux.

Now I'm trying to port it to a Playbook. It fails with the following error:


Malloc Check Failed: :/builds/GR2_0_0_CE3-Worldbuild/latest/svn/lib/c/alloc/band.c:492

The most interesting part is that sometimes after rebuilding it suddenly runs without any error!

I'm using Simlator 2.0.0 and NDK 2.0.0.

I don't know what to do and I count on your support.

Thanks in advance.

Developer
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
My Carrier: None

Re: Malloc Check Failed while porting Qt app

[ Edited ]

Looks like you have a Bug in in your App or in a used library. Maybe you didn't initialize a variable correctly.

 

If it sometimes runs without problems this could be of the random values in memory.

 

Try valgrind to check your App. Maybe you can find the problem.

 

P.S. I sometimes also have to completely rebuild (qmake, clean, rebuild) the project to get it working.

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Malloc Check Failed while porting Qt app

It's impossible to help you without seeing your code.

Contributor
Posts: 22
Registered: ‎02-02-2012
My Device: none
My Carrier: none

Re: Malloc Check Failed while porting Qt app

I just want to know whether is it a known blackberry issue or that's my problem (I remind you that it works in Linux). Thank you anyway, I'll try to valgrind it.

Developer
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
My Carrier: None

Re: Malloc Check Failed while porting Qt app

I also use massive network connections (mostly http but also some https)and didn't have the error. But I doesn't use the Simulator.

 

Back to my idea: every compiler produces different code and every system handles memory different. It maybe, it's running on Linux without a problem and crashes on Windows. If you use a pointer that is not correctly initialized and you access the data it can produce many different errors on different systems or even starts of the program, cause the memory could be written to in the meantime.

 

If the pointer is 0 you will get an coredump on Linux. If the value of the pointer is within normal memory used by the prog you will get access to it and everything seems to run "normal". So I always initialize every variable to be shure to have a valid value or NULL.

 

So just try valgrind to see if you get some errors. Just install it and start your App with valgrind. You can use your Linux-Version for it to check your code. I have no Idea how to do it in the simulator :-(

Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Malloc Check Failed while porting Qt app

Hello, I'm having the same error. I'm porting a game fro ios to pb and bb10, the game is almost in c++ that why should be easy.

I really don't know how to debug this beacause when I recive this error I can't see the stack, or the only call I can se before the error are from the system.

I also can see another threads but either without usefull info.

How can I launch valgrind on pb? I'm using a mac with momentics ide.

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Malloc Check Failed while porting Qt app

Usually when an exception happens you have full list of function calls in your debugger (IDE), don't you have that?

Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Malloc Check Failed while porting Qt app

Yes, I have, but they are all system calls and nothing to do with my app. Thats why im lost.

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Malloc Check Failed while porting Qt app

I don't understand how it is possible, there must be at least one call from your app ont the top.

Or you can go step-by-step in debugger (in your app) and see when the error pops up.

New Contributor
Posts: 8
Registered: ‎11-02-2012
My Device: Blackberry Playbook
My Carrier: n/a

Re: Malloc Check Failed while porting Qt app

I've just hit this myself - no app functions in the stack trace just some really nasty looking system calls. The list I have is:

 

SignallKill() at 0x175c7b8

raise() at 0x174cc68

__malloc_panic_str() at 0x1747d44

_band_get_aligned() at -x17465cc

0x174ad4c

0x174ad4c

 

I'm just about to fine tunely debug this but did anybody come up a with a resolution to a similar problem?