Opened 15 years ago
Closed 15 years ago
#249 closed defect (fixed)
GEOS, Shapely, DLLs, and memory
Reported by: | aronb | Owned by: | warmerdam |
---|---|---|---|
Priority: | major | Milestone: | 3.2.0 |
Component: | C API | Version: | 3.1.0 |
Severity: | Significant | Keywords: | runtime heap |
Cc: | pramsey |
Description
Add a GEOSFree function to the capi so that users can free memory allocated in the GEOS DLL from the same DLL. This is needed if the user code is using a different copy of the CRT than GEOS.
Attachments (1)
Change History (7)
by , 15 years ago
Attachment: | geos.patch added |
---|
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
A minor impr. to the patch - missing std qualifier:
void GEOSFree (void* buffer) { std::free(buffer); }
comment:3 by , 15 years ago
Cc: | added |
---|---|
Component: | Default → C API |
Keywords: | runtime heap added |
Owner: | changed from | to
Severity: | Unassigned → Significant |
Status: | assigned → new |
I have apply the change in trunk, and added a GEOSFree_r() (r2506). I don't understand the requirement for std:: qualifier and did not add it.
I would still like to backport this into the stable 3.2 and 3.0 branches but this will apparently require further discussion on the list.
comment:4 by , 15 years ago
Frank,
The free() function is declared in <cstdlib> and this header should be included (and it is from geos_ts_c.cpp). The free() function (as all C++ free standard functions) is declared in std namespace. So, std::free() should be qualified with name of its namespace, for the same reasons why std::vector<int> but not vector<int>.
BTW, shouldn't GEOSFree delegate deallocation to GEOSFree_r?
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
With the implicit permission on the list I have applied the changes in 3.1 branch as well (r2509).
I believe testing for a CAPI version of greater than 1.5.0 should be sufficient to know if GEOSFree() is available as part of the GEOS C API.
GEOSFree patch