🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pilot.programmer.codewarrior
Article #25

Re: char* memory leak with emulator 3.5

#25
From: Ben Combee
Date: Wed, 09 Oct 2002 11:34
15 lines
1958 bytes
In article <30890494.0210080905.64899638@posting.google.com>, 
david_ladanyi@yahoo.com says...
> When I put in a "delete psaStr" line it produced a memory error
> because the pointer was being used by the field. I managed to fix the
> problem by declaring "char psaStr[6];" instead of "char* psaStr = new
> char[6];"

Is psaStr a local variable or a global?  If its local, you might have 
just passed a pointer to stack space into a global structure -- this is 
bad, as that space can and will be used for other variables after the 
current function exits.
-- 
Ben Combee <bcombee@metrowerks.com>
CodeWarrior for Palm OS technical lead
Get help at http://palmoswerks.com/
Technical Details
Message-ID: <MPG.180dcfbc414a20d79898c2@news.earthlink.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feeder.via.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail
References: <30890494.0210062256.7a8a8fa@posting.google.com> <uq35nhqhshk23@corp.supernews.com> <30890494.0210080905.64899638@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d41,fc0bc5958a8d445f
X-Google-Attributes: gid109d41,public
X-Google-Thread: 10baa0,fc0bc5958a8d445f
X-Google-Attributes: gid10baa0,public
X-Google-ArrivalTime: 2002-10-09 04:34:51 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feeder.via.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail
From: Ben Combee <combee@techwood.org>
Newsgroups: pilot.programmer.codewarrior,codewarrior.palm
Subject: Re: char* memory leak with emulator 3.5
Message-ID: <MPG.180dcfbc414a20d79898c2@news.earthlink.net>
References: <30890494.0210062256.7a8a8fa@posting.google.com> <uq35nhqhshk23@corp.supernews.com> <30890494.0210080905.64899638@posting.google.com>
Organization: Techwood Broadcasting Foundation
X-Newsreader: MicroPlanet Gravity v2.60
Lines: 15
Date: Wed, 09 Oct 2002 11:34:43 GMT
NNTP-Posting-Host: 24.206.100.29
X-Complaints-To: abuse@earthlink.net
X-Trace: newsread2.prod.itd.earthlink.net 1034163283 24.206.100.29 (Wed, 09 Oct 2002 04:34:43 PDT)
NNTP-Posting-Date: Wed, 09 Oct 2002 04:34:43 PDT