Skip to content

Conversation

@davyw
Copy link
Member

@davyw davyw commented Feb 27, 2012

First version of scl_memmgr implementation.
Fixes issues #142 and #147.

I've noticed however that other schema's also generate 'corrupted' output, since I've found the issue for ap210e2 code generation by adding 'safe' string manipulation functions (msvc specific), I would prefer to add scl based 'safe' string functions next, as this will probably tell me what the problems are with other schemas.
After that I would add scl_memmgr usage to the rest of the code (at the moment only added until fedex_plus).

At the moment there is a separate base library to contain scl_memmgr, if it is preferred to add this functionality
to express library in stead, I will need to move it.

Issue #147 is not really related to memory problems, but since I needed to add the base library reference there
I fixed the build errors at the same time.

* scl_memmgr supports both c and c++ memory management.
  malloc, calloc, realloc and free for c.
  new, delete operators for c++.
  (in c++ files scl_memmgr.h should be included last because a macro
   is used to replace new and delete with scl versions. If not included
   last, this would break build.)
* Replaced malloc, calloc, realloc and free with scl_memmgr versions.
* Added scl_memmgr.h includes.
* Replaced malloc, calloc, realloc and free with scl_memmgr versions.
* Added scl_memmgr.h includes.
* Replaced malloc, calloc, realloc and free with scl_memmgr versions.
* Added scl_memmgr.h includes.
* Mixed code/declarations are not allowed for c files on msvc.
  Moved variable declarations to top of function where needed.
* Added base library usage to fedex_python application.
@tpaviot
Copy link
Member

tpaviot commented Feb 28, 2012

macbook-pro-de-thomas-paviot:cmake-build thomas$ make
Scanning dependencies of target version_string
[  2%] Generating ver_string, include/scl_version_string.h
-- scl_version_string.h is up-to-date.
[  2%] Built target version_string
Scanning dependencies of target base
[  2%] Building CXX object src/base/CMakeFiles/base.dir/scl_memmgr.cc.o
/Users/thomas/Devel/StepClassLibrary/src/base/scl_memmgr.cc:4:20: error: malloc.h: No such file or directory
/Users/thomas/Devel/StepClassLibrary/src/base/scl_memmgr.cc:288: warning: unused parameter ‘file’
/Users/thomas/Devel/StepClassLibrary/src/base/scl_memmgr.cc:288: warning: unused parameter ‘line’
make[2]: *** [src/base/CMakeFiles/base.dir/scl_memmgr.cc.o] Error 1
make[1]: *** [src/base/CMakeFiles/base.dir/all] Error 2
make: *** [all] Error 2

@tpaviot
Copy link
Member

tpaviot commented Feb 28, 2012

Here is a patch for OSX: https://gist.github.com/1933848

@davyw
Copy link
Member Author

davyw commented Feb 28, 2012

@tpaviot Your patch has been applied for malloc.h include.
BTW What is your thought on a separate base library in stead of scl_memmgr added to express library?

@mpictor
Copy link
Member

mpictor commented Feb 29, 2012

I ran all tests. There are some segfaults, but those are on p21 files that weren't tested before AFAIK.

Also, there are a large number of spurious failures that are due to me dropping the ap219 schema into scl/data instead of putting it in a subfolder. In that location, cmake creates tests with that schema and all p21 files it finds in each subfolder.

http://my.cdash.org/viewTest.php?buildid=303803

@tpaviot
Copy link
Member

tpaviot commented Feb 29, 2012

@davyw I think it's better to have memory management in a separate library. A clear functional boundary for each lib will make SCL easier to maintain. Some basic functions should also be extracted from fedex_plus and moved into another library so that other programs can use them (fedex_python for instance, but not only) without be linked to fedex_plus, which should be dedicated to C++ code generation. At last, commit 7ec9f7d should not be part of that dev branch since it's not related to memory management.

@davyw
Copy link
Member Author

davyw commented Feb 29, 2012

@tpaviot I know it was not related to memory management, it just fixed msvc build and added base lib to fedex_python.
I needed to add base lib to get it to build because it uses files from the fedex_plus folder, which is where I added memory management include folders.
Should I remove this commit and create another pull request, or just put a patch on gist?

@tpaviot
Copy link
Member

tpaviot commented Mar 1, 2012

@davyw It depends on the lifecycle of the current review/scl_memmgr branch. If it is planned to be merged very soon, it's not worth moving the python related commit to another dev branch. However, the python generator development goes fast currently, and I'd like to avoid conflicts if this pull request is merged in a few days.

mpictor added a commit that referenced this pull request Mar 1, 2012
@mpictor mpictor merged commit 89035cd into master Mar 1, 2012
@mpictor
Copy link
Member

mpictor commented Mar 1, 2012

@tpaviot problem solved :)

@tpaviot
Copy link
Member

tpaviot commented Mar 1, 2012

@mpictor ok, I rebased the python branch onto master. As I feared, I had to manually fix some conflict, but it was not that hard.

@davyw
Copy link
Member Author

davyw commented Mar 1, 2012

@tpaviot,
I will refrain from editing fedex_python code to prevent further conflicts.
If I find any problem on windows I'll send patch through gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants