-lmalloc_g causes PtFileSel errors

I know this sounds fanciful, but try this…

Create a PhAB application that contains only a single PtFileSel
widget, and set its default path to a directory that contains both
files and directories. Use the test button in PhAB to prove that it
shows both files and directories. Compile and run. You should see
files and directories in the file list.

Now, edit the Makefile to add the lines:

LDFLAGS += -lmalloc_g
SDFLAGS += -lmalloc_g

Make clean, compile (shared) and run. The PtFilSel displays directory
names, but does not display file names.

I’m using Patch B.

Cheers,
Andrew

Sorry don’t answer your question… but what is malloc_g?
just curious
Markus

“Andrew Thomas” <Andrew@cogent.ca> wrote in message
news:Voyager.010502225425.60182571B@andrewhome.cogent.ca

I know this sounds fanciful, but try this…

Create a PhAB application that contains only a single PtFileSel
widget, and set its default path to a directory that contains both
files and directories. Use the test button in PhAB to prove that it
shows both files and directories. Compile and run. You should see
files and directories in the file list.

Now, edit the Makefile to add the lines:

LDFLAGS += -lmalloc_g
SDFLAGS += -lmalloc_g

Make clean, compile (shared) and run. The PtFilSel displays directory
names, but does not display file names.

I’m using Patch B.

Cheers,
Andrew

Previously, Markus Loffler wrote in qdn.public.qnxrtp.photon:

Sorry don’t answer your question… but what is malloc_g?
just curious

It’s a replacement library for malloc() and free() that does some
bounds checking and memory corruption checking. All you should have
to do is use -lmalloc_g in the link line and you get a certain amount
of memory checking done for you (at a CPU penalty).

Andrew

“Andrew Thomas” <Andrew@cogent.ca> wrote in message
news:Voyager.010504115524.733220A@andrewhome.cogent.ca

Previously, Markus Loffler wrote in qdn.public.qnxrtp.photon:
Sorry don’t answer your question… but what is malloc_g?
just curious

It’s a replacement library for malloc() and free() that does some
bounds checking and memory corruption checking. All you should have
to do is use -lmalloc_g in the link line and you get a certain amount
of memory checking done for you (at a CPU penalty).

I believe it checks more than that. All memxxx() and strxxx() I think.
There is doc in ‘technotes’ section (Heap Analisys)

  • igor

In article <9cvoev$m6c$1@inn.qnx.com>,
Igor Kovalenko <kovalenko@home.com> wrote:

“Andrew Thomas” <> Andrew@cogent.ca> > wrote in message
news:> Voyager.010504115524.733220A@andrewhome.cogent.ca> …
Previously, Markus Loffler wrote in qdn.public.qnxrtp.photon:
Sorry don’t answer your question… but what is malloc_g?
just curious

It’s a replacement library for malloc() and free() that does some
bounds checking and memory corruption checking. All you should have
to do is use -lmalloc_g in the link line and you get a certain amount
of memory checking done for you (at a CPU penalty).

I believe it checks more than that. All memxxx() and strxxx() I think.
There is doc in ‘technotes’ section (Heap Analisys)

You’re right, Igor. The best indication of what checks it performs is
to read the tech note. Basically, any time you malloc or free, a number
of checks will be performed against the affected block. This may include
guard checking for overruns, as well as a bunch of consistency checks
on the block header – checksum, etc – to catch underruns – in addition
to basic validation, like duplicate free requests. The mem* and str*
functions are covered with versions that check if the parameter is
a valid heap block, then ensures that the range of the parameters is
within the bounds of the block.

The library can also trace the heap to determine if there are memory
leaks.

As far as Andrew’s concern goes, we’ll have to see if the Photon library
group can do any tests to see what is occurring with PtFileSelector, or
perform more extensive testing against the library. I haven’t heard
of or seen this before.


\


Steve Furr email: furr@qnx.com
QNX Software Systems, Ltd.