public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Segmentation Fault: new char[12]
@ 1999-12-07 12:11 atharaken
  1999-12-07 18:21 ` hwidjaja
  1999-12-31 22:24 ` atharaken
  0 siblings, 2 replies; 14+ messages in thread
From: atharaken @ 1999-12-07 12:11 UTC (permalink / raw)
  To: help-gcc

This is a snippet of some code I am using. I get a Segmentation Fault
in _smalloc (malloc). It works sometimes and when a large number of
users are accessing it gives a segmentation fault.

It happens at the line:

_string = new char [_capacity];

I call this using _Init(12);
This is a protected class.


/* BEGIN CODE HERE */

bool MyClass::_Init (long size)
{
    _capacity = size;
    _string = new char [_capacity]; //Get Segmentation Fault at _smalloc
    if (!_string) {
        _capacity = _size = 0L;
        return false;
    }
    _size = 0;
    _string[0] = '\0';
    return true;
}

/*END CODE HERE */


Machine: i386
OS: Solaris 7
GCC 2.95 (Release)

Any help is appreciated

Thanks


Sent via Deja.com http://www.deja.com/
Before you buy.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-07 12:11 Segmentation Fault: new char[12] atharaken
1999-12-07 18:21 ` hwidjaja
1999-12-08  6:51   ` atharaken
1999-12-08 14:22     ` hwidjaja
1999-12-31 22:24       ` hwidjaja
1999-12-31 22:24     ` atharaken
1999-12-08  7:21   ` atharaken
1999-12-08 10:35     ` Mike Albaugh
1999-12-08 10:54       ` Josh Gagliardi
1999-12-31 22:24         ` Josh Gagliardi
1999-12-31 22:24       ` Mike Albaugh
1999-12-31 22:24     ` atharaken
1999-12-31 22:24   ` hwidjaja
1999-12-31 22:24 ` atharaken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).