On 04/01/2012 02:38 AM, skr...@hushmail.com wrote: > https://github.com/skrapsrwt/dbmail-memcache/
I looked at the 'push change and added some comments. Most importantly you need to understand C doesn't have automatic allocation/de-allocation of memory like PHP does. If you want to assign something to a chunk of memory that memory must be allocated, either on the 'stack', or on the 'heap'. The stack is local to the scope. So it can be passed 'down-stream' if you are careful, but it can never be returned to the calling scope. The heap is where malloc/free do their thing: a global memory space that you can use - if you use it following the rules. Heap memory is always safe to pass around. - you must allocated everything you need. - for each malloc call, there must be a free call. stack allocation: char foo[128]; // char array on the stack you can assign 128 bytes to char *foo = g_new0(char, 128); // same size char array on the heap g_new0 is a simple wrapper around calloc. It allocates memory and cleans it out. If you allocate on the stack it is always a good idea to clean it explicitely: char foo[128]; memset(foo, 0, sizeof(foo)); -- ________________________________________________________________ Paul J Stevens pjstevns @ gmail, twitter, skype, linkedin * Premium Hosting Services and Web Application Consultancy * www.nfg.nl/i...@nfg.nl/+31.85.877.99.97 ________________________________________________________________ _______________________________________________ Dbmail-dev mailing list Dbmail-dev@dbmail.org http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev