Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMBEDMYMALLOC Still Broken in _61 #443

Closed
p5pRT opened this issue Aug 26, 1999 · 6 comments
Closed

EMBEDMYMALLOC Still Broken in _61 #443

p5pRT opened this issue Aug 26, 1999 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 26, 1999

Migrated from rt.perl.org#1284 (status was 'resolved')

Searchable as RT1284$

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 1999

From allen@huarp.harvard.edu

Out of the box on QNX this fails with bad free messages during
testing because PERL_BINCOMPAT_5005 is the default and this
implies PERL_POLLUTE_MALLOC in embed.h. Note that EMBEDMYMALLOC
has been added as default in perl.h, but only after embed.h has
been included (!defined(PERL_FOR_X2P)&&!defined(PERL_OBJECT)).
Adding -D EMBEDMYMALLOC doesn't work because the definition
clashes with the one in perl.h.

Note that embed.h is included in two places within perl.h,
presumably to avoid various conflicts with system include files.
(Who knows?) I'd be inclined to move the first inclusion down
below the MALLOC definitions, but I have no idea what the side
effects would be. Alternately the MALLOC stuff could be moved up
above the first embed.h inclusion.

Who knows the significance of the location of the embed.h
inclusion?

  -Norton Allen

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 1999

From [Unknown Contact. See original ticket]

It works fine for me with "-DEMBEDMYMALLOC=" in ccflags.

On Thu, 26 Aug 1999 11​:32​:57 -0400 (edt), Norton Allen wrote (in part)​:

Norton> Out of the box on QNX this fails with bad free messages
Norton> during testing because PERL_BINCOMPAT_5005 is the default
Norton> and this implies PERL_POLLUTE_MALLOC in embed.h. Note
Norton> that EMBEDMYMALLOC has been added as default in perl.h,
Norton> but only after embed.h has been included
Norton> (!defined(PERL_FOR_X2P)&&!defined(PERL_OBJECT)). Adding
Norton> -D EMBEDMYMALLOC doesn't work because the definition
Norton> clashes with the one in perl.h.

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 1999

From [Unknown Contact. See original ticket]

Spider Boardman wrote​:

  My compiler dies, reporting that the new definition does not
  match the earlier definition. The 'new' definition is
  #define EMBEDMYMALLOC /* for compatability */
  and apparently the compiler sees that as different from empty.
 
  Another possibility would be to bracket the definition in
  perl.h with #ifndef EMBEDMYMALLOC, as is often done.
 

It works fine for me with "-DEMBEDMYMALLOC=" in ccflags.

On Thu, 26 Aug 1999 11​:32​:57 -0400 (edt), Norton Allen wrote (in part)​:

Norton> Out of the box on QNX this fails with bad free messages
Norton> during testing because PERL_BINCOMPAT_5005 is the default
Norton> and this implies PERL_POLLUTE_MALLOC in embed.h. Note
Norton> that EMBEDMYMALLOC has been added as default in perl.h,
Norton> but only after embed.h has been included
Norton> (!defined(PERL_FOR_X2P)&&!defined(PERL_OBJECT)). Adding
Norton> -D EMBEDMYMALLOC doesn't work because the definition
Norton> clashes with the one in perl.h.

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 1999

From [Unknown Contact. See original ticket]

Spider Boardman wrote​:

It works fine for me with "-DEMBEDMYMALLOC=" in ccflags.

To expand on what I said before, the definition of EMBEDMYMALLOC
in perl.h is currently ineffective since embed.h is included
before it is defined. We should either​:

1) Eliminate the definition in perl.h and rely on -DEMBEDMYMALLOC
2) Rearrange perl.h to define EMBEDMYMALLOC before including
embed.h

I prefer 2) since it then compiles out of the box without
additional special casing, but I can obviously make 1) work with
a tweak to hints/qnx.sh.

Here's a rearrangement of perl.h that works for me. YMMV.

=============

*** perl5.005_61.ORIG/perl.h Fri Aug 20 18​:10​:13 1999
--- perl5.005_61/perl.h Thu Aug 26 13​:32​:42 1999
***************
*** 479,505 ****
  # include <stdlib.h>
  #endif
 
- #if !defined(PERL_FOR_X2P) && !defined(PERL_OBJECT)
- # include "embed.h"
- #endif
-
  #define MEM_SIZE Size_t
 
- #if defined(STANDARD_C) && defined(I_STDDEF)
- # include <stddef.h>
- # define STRUCT_OFFSET(s,m) offsetof(s,m)
- #else
- # define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m))
- #endif
-
- #if defined(I_STRING) || defined(__cplusplus)
- # include <string.h>
- #else
- # include <strings.h>
- #endif
-
  /* This comes after <stdlib.h> so we don't try to change the standard
! * library prototypes; we'll use our own in proto.h instead. */
 
  #ifdef MYMALLOC
  # ifdef PERL_POLLUTE_MALLOC
--- 479,490 ----
  # include <stdlib.h>
  #endif
 
  #define MEM_SIZE Size_t
 
  /* This comes after <stdlib.h> so we don't try to change the standard
! * library prototypes; we'll use our own in proto.h instead.
! * It must come before embed.h or EMBEDMYMALLOC won't take
! * effect. */
 
  #ifdef MYMALLOC
  # ifdef PERL_POLLUTE_MALLOC
***************
*** 529,534 ****
--- 514,536 ----
  # define saferealloc safesysrealloc
  # define safefree safesysfree
  #endif /* MYMALLOC */
+
+ #if !defined(PERL_FOR_X2P) && !defined(PERL_OBJECT)
+ # include "embed.h"
+ #endif
+
+ #if defined(STANDARD_C) && defined(I_STDDEF)
+ # include <stddef.h>
+ # define STRUCT_OFFSET(s,m) offsetof(s,m)
+ #else
+ # define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m))
+ #endif
+
+ #if defined(I_STRING) || defined(__cplusplus)
+ # include <string.h>
+ #else
+ # include <strings.h>
+ #endif
 
  #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
  #define strchr index

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2004

From @rspier

This bug is five years old. Closing.

@p5pRT p5pRT closed this as completed Jul 27, 2004
@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2004

@rspier - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant