2
웹 서비스 클래스를 생성하기 위해 gsoap을 사용합니다. 클래스를 삭제할 때 무료 또는 삭제 문을 보지 못합니다. 클래스의 멤버를 수동으로 삭제해야합니까? - 또는 gsoup destroy 기능이 이에 대한 책임이 있습니까? 이 내 샘플 수업을 통해 중 하나입니다C++ 모드에서 메모리 작업을 gsoap하는 방법은 무엇입니까?
class SOAP_CMAC ns2__FirstOfflineReserve
{
public:
short *consumed; /* optional element of type xsd:short */
class ns2__FirstOfflineFood *food; /* optional element of type ns2:FirstOfflineFood */
class ns2__FirstOfflineFoodType *foodType; /* optional element of type ns2:FirstOfflineFoodType */
int *id; /* optional element of type xsd:int */
class ns2__FirstOfflineMeal *meal; /* optional element of type ns2:FirstOfflineMeal */
short *remainCount; /* optional element of type xsd:short */
short *selectedCount; /* optional element of type xsd:short */
std::string *serialCard; /* optional element of type xsd:string */
std::string *username; /* optional element of type xsd:string */
struct soap *soap; /* transient */
public:
virtual int soap_type() const { return 36; } /* = unique id SOAP_TYPE_ns2__FirstOfflineReserve */
virtual void soap_default(struct soap*);
virtual void soap_serialize(struct soap*) const;
virtual int soap_put(struct soap*, const char*, const char*) const;
virtual int soap_out(struct soap*, const char*, int, const char*) const;
virtual void *soap_get(struct soap*, const char*, const char*);
virtual void *soap_in(struct soap*, const char*, const char*);
ns2__FirstOfflineReserve() { ns2__FirstOfflineReserve::soap_default(NULL); }
virtual ~ns2__FirstOfflineReserve() { }
};
와 나는
calcProxy calc(SOAP_IO_KEEPALIVE); // keep-alive improves connection performance
double sum = 0.0;
double val[] = 5.0, 3.5, 7.1, 1.2 ;
for (int i = 0; i < 4; i++)
if (calc.add(sum, val[i], sum))
return calc.error;
std::cout << "Sum = " << sum << std::endl;
return 0;
지금 우리가 비누의 기능을 파괴 전화를 해달라고이 예와 같이 웹 서비스에 빠르게 호출 살아 비누를 유지하기위한 자습서를 참조하십시오 그래서 비누 물체를 삭제하는 것에 대해 걱정할 필요가 없습니까? 나를 위해 메모리 누수에
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
/* create a soap environment (provides soap services) */
soap = soap_new();
break;
case DLL_PROCESS_DETACH:
/* terminate soap services */
soap_end(soap); //discontinue soap services
soap_free(soap); //free soap resources
break;
}
/* Return 1 to indicate successful initialization */
return 1;
}
이 접근 결과 :
답변이 없으므로 대답은 확실한가요? 아닙니다. 내 질문의 일부 2에 대한 전 후에 calc.destroy 추가 일부 라이브러리 문제가 메시지가 있습니다. –
valgrind 또는 다른 메모리 검사기를 통해 실행하여 메모리 누수가 발생했는지 확인하고 * 걱정 * 시작하는지 확인하십시오. gsoap은 악몽이고 C++에게는별로 친숙하지 않습니다. – trojanfoe
귀하의 의견을 보내 주셔서 감사하지만 valgrind는 아마도 삭제하지 말라고 말합니다 : D, 나는 확실히 말할 수 없습니다. 임베디드 시스템에서 프로그램을 실행하고 싶습니다. 이제 걱정이됩니다. ( –