----- Original Message -----
From: "Eric Wilhelm" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 28, 2005 4:01 PM
Subject: Re: New() vs malloc() [was Re: Debugging segfault]
> # The following was supposedly scribed by
> # Sisyphus
> # on Monday 27 June 2005 10:09 pm:
>
> >Just idly browsing through the code and I noticed:
> >
> >SV* new (char* class) {
> > gpc_polygon* p = malloc(sizeof(gpc_polygon));
> >
> >whereas I would expect something like:
> >
> >SV* new (char* class) {
> > gpc_polygon* p;
> >New(42, p, 1, gpc_polygon);
> >
> >Any particular reason for the former, as opposed to the latter ?
>
> The code that I cribbed off of had malloc's in it and I've never had any
> trouble with it :-)
Yeah .... that's fair enough. (My concern was that there might have been
some distinct advantage in using 'malloc' over 'New'.)
>
> That's what I meant about using OO. I won't ever access that outside of
> the Inline'd methods, so I don't have an object count issue, etc. I'm
> sure there's something nasty lurking in there if I were to compile it
> on a less forgiving OS.
>
I have this notion that there's a potential for conflict if you compile that
code on a perl built with 'usemymalloc=yes'. Mind you, I've got such a perl
on my Win32 box and haven't been able to create such a conflict ... but the
notion persists, anyway :-)
Basically, I don't really understand how problems with 'malloc' can arise,
so I just (try to) avoid it to be safe.
Cheers,
Rob