Help? seg-fault...

Michael Wieher michael.wieher at gmail.com
Tue Jul 1 19:29:02 UTC 2008


hey all.
I'm pretty new to using memcached, but have already found it
incredibly powerful.

I don't run into any problems using it, but when my program exits, it
dies with a seg-fault.

If  I comment this function out, there is no seg-fault:

    int getCachedRequest(char* ans,char* req,iniData* data) {
        memcached_return mcr;
        uint32_t flags;
        size_t size;
        char * cp;
        cp = memcached_get(&(data->mc),req,strlen(req),&size,&flags,&mcr);
        if(mcr==0) {
            memcpy(ans,cp,strlen(cp));
            free(cp);cp=NULL;
            return 1;
        }
        free(cp);cp=NULL;
        return 0;
    }


if I use it, there is.
any suggestions on how or why to diagnose the problem?
as you can see, I have a structure "iniData data" that holds a pointer
to the memcached_st
....
its pretty simple, straightforward, and as I say, no problems during
execution, works beautifully, but when exiting, something in the
cleanup behind the scenes gets confused and segfaults out.
its nothing a call to _exit() won't .... "fix" but I'd really rather
avoid that if I can.

Thanks,
-mike


More information about the memcached mailing list