{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/7be860fb8bf806f5d05127469ce52718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"7be860fb8bf806f5d05127469ce52718","url":"https://api.github.com/users/dkastl","login":"dkastl","id":227762},"assignee":{"avatar_url":"https://secure.gravatar.com/avatar/7be860fb8bf806f5d05127469ce52718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"7be860fb8bf806f5d05127469ce52718","url":"https://api.github.com/users/dkastl","login":"dkastl","id":227762},"updated_at":"2011-11-16T13:56:04Z","labels":[],"closed_at":null,"comments":7,"url":"https://api.github.com/repos/pgRouting/pgrouting/issues/42","body":"As reported by this user there seems to be a memory allocation problem in DD.\r\nhttp://lists.osgeo.org/pipermail/pgrouting-users/2011-August/000771.html","html_url":"https://github.com/pgRouting/pgrouting/issues/42","title":"Memory allocation - memory not freed in DD?","number":42,"id":1527518,"created_at":"2011-08-31T02:47:09Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/c56e17d202a55274d9f1d4120577cd12?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c56e17d202a55274d9f1d4120577cd12","url":"https://api.github.com/users/christiangda","login":"christiangda","id":1197820},"updated_at":"2011-11-16T13:56:04Z","url":"https://api.github.com/repos/pgRouting/pgrouting/issues/comments/2759605","body":"Hi Daniel,\n\nI found it on PostgreSQL documentation.\n\nLink: http://developer.postgresql.org/pgdocs/postgres/xfunc-c.html\n35.9.12. Using C++ for Extensibility\n\nAlthough the PostgreSQL backend is written in C, it is possible to write\nextensions in C++ if these guidelines are followed:\n\n   -\n\n   All functions accessed by the backend must present a C interface to the\n   backend; these C functions can then call C++ functions. For example, extern\n   C linkage is required for backend-accessed functions. This is also\n   necessary for any functions that are passed as pointers between the backend\n   and C++ code.\n   -\n\n   Free memory using the appropriate deallocation method. For example, most\n   backend memory is allocated using palloc(), so use pfree() to free it.\n   Using C++ delete in such cases will fail.\n   -\n\n   Prevent exceptions from propagating into the C code (use a catch-all\n   block at the top level of all extern C functions). This is necessary\n   even if the C++ code does not explicitly throw any exceptions, because\n   events like out-of-memory can still throw exceptions. Any exceptions must\n   be caught and appropriate errors passed back to the C interface. If\n   possible, compile C++ with -fno-exceptions to eliminate exceptions\n   entirely; in such cases, you must check for failures in your C++ code, e.g.\n   check for NULL returned by new().\n   -\n\n   If calling backend functions from C++ code, be sure that the C++ call\n   stack contains only plain old data structures (POD). This is necessary\n   because backend errors generate a distant longjmp() that does not\n   properly unroll a C++ call stack with non-POD objects.\n\n In summary, it is best to place C++ code behind a wall of extern\nCfunctions that interface to the backend, and avoid exception, memory,\nand\ncall stack leakage.\n\n\nChristian\n\n2011/11/16 Christian F. Gonzalez Di Antonio <christiangda@gmail.com>\n\n> Well, I hope it.   If you read the documentation in the links, you can\n> call a \"c\" function into \"c++\" code.  Now, how do you apply it?, well, just\n> now I don't know,  but if you or somebody have more experience programing\n> in \"c\", maybe could implemented it.\n> Then we can used valgrind tool to check it!.\n>\n> Christian\n>\n>\n>\n> 2011/11/15 Daniel Kastl <\n> reply@reply.github.com\n> >\n>\n>> Hi Christian!\n>> So you think this solves issue #46 ?\n>>\n>> ---\n>> Reply to this email directly or view it on GitHub:\n>> https://github.com/pgRouting/pgrouting/issues/42#issuecomment-2754534\n>>\n>\n>\n>\n> --\n> Atentamente,\n> Christian Gonzalez\n>\n\n\n\n-- \nAtentamente,\nChristian Gonzalez","id":2759605,"created_at":"2011-11-16T13:56:04Z"}}