![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: Is there a restriction on using both malloc/free and new/delete in the same application compiled through the DEC C++ compiler? If so, is this restriction only on calls within the same source file or will the restriction limit the use of malloc/free in on e object code file linked with a different object code file using new/delete? Finally, does it matter if the code using malloc/free is compiled using a C (rather than C++) compiler but then linked into the C++ application? We are using OpenVMS Version 7.1-2, DEC C++ version 5.6-013, and DEC C version 5.7-004 on an Alpha processor The Answer is : There are generally few (or no) restrictions on mixing the use of different memory management schemes within the same application. (eg: You can use the C malloc and free calls and the RTL lib$get_vm and lib$free_vm calls in the same application source module.) There are restrictions on using compatible memory management calls when processing the same block of memory. (eg: if you allocate a block of memory via the C malloc call, you must use the C free call to release it. You can not and must not use the RTL lib$free_vm call to release the memory allocated by malloc.) Most (all?) language-specific memory management calls on OpenVMS will eventually call a selection of memory management routines provided within the LIB RTL, and can thus coexist. Mixed-language programming is supported on OpenVMS.
|