|
-
July 2nd, 2003, 08:39 AM
#1
Is there a problem using malloc and new together?
Hi,
I try to solve a problem in a C++ code I did not write:
When I run the application I get a memory problem, and the message says that memory was allocated with new and ran over with malloc.
Is this really the problem, or is it a simptom for something else?
Is there a known problem with using new and malloc in the same application?
Another note: the problem appears only when compiled with debug information.
The application runs under OS/2 operating system.
The relevant parts of the code:
Code:
void *d_area;
int dsize=10;
d_area = malloc (dsize);
--------
char *penv = getenv ("xxxx");
char *grp;
grp = new char (sizeof (penv) + 1);
Please note that this is only the suspected lines, and the statement int dsize=10; and similar are only shown here for understanding the inportant lines (new and malloc)
Thanks.
Last edited by sapird; July 2nd, 2003 at 08:50 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|