<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:55:53 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-1042] mongo c++ headers have a #define for malloc, this breaks code compilation with certain boost headers</title>
                <link>https://jira.mongodb.org/browse/SERVER-1042</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When building a very simple app which includes mongo headers and other boost headers, the app fails to build. The problem is that mongo headers have a #define for malloc which is forced upon your program silently. &lt;/p&gt;

&lt;p&gt;This piece of code will fail to compile. The error will indicate that malloc is now mongo::ourmalloc which is most certainly NOT what the user wants. It also causes a conflict with the boost header which has a member function called malloc.&lt;/p&gt;

&lt;p&gt;#include &amp;lt;mongo/client/dbclient.h&amp;gt;&lt;br/&gt;
#include &amp;lt;boost/pool/pool.hpp&amp;gt;&lt;/p&gt;

&lt;p&gt;int main(int argc, char* argv[])&lt;br/&gt;
{&lt;br/&gt;
    malloc();&lt;br/&gt;
    return 0;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;error when building:&lt;br/&gt;
In file included from /usr/include/boost/pool/pool.hpp:34,&lt;br/&gt;
                 from shit.c:2:&lt;br/&gt;
/usr/include/boost/pool/simple_segregated_storage.hpp:99: error: invalid use of &apos;::&apos;&lt;br/&gt;
In file included from shit.c:2:&lt;br/&gt;
/usr/include/boost/pool/pool.hpp:54: error: invalid use of &apos;::&apos;&lt;br/&gt;
/usr/include/boost/pool/pool.hpp:65: error: invalid use of &apos;::&apos;&lt;br/&gt;
/usr/include/boost/pool/pool.hpp:219: error: invalid use of &apos;::&apos;&lt;br/&gt;
/usr/include/mongo/client/../util/allocator.h: In function &apos;int main(int, char**)&apos;:&lt;br/&gt;
/usr/include/mongo/client/../util/allocator.h:22: error: too few arguments to function &apos;void* mongo::ourmalloc(size_t)&apos;&lt;br/&gt;
shit.c:6: error: at this point in file&lt;/p&gt;

&lt;p&gt;The expected error here is error: too few arguments to function &apos;void* malloc(size_t)&apos;  when the systems (proper) malloc is used&lt;/p&gt;</description>
                <environment>Ubuntu Lucid running mongo-stable</environment>
        <key id="11829">SERVER-1042</key>
            <summary>mongo c++ headers have a #define for malloc, this breaks code compilation with certain boost headers</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="mathias@mongodb.com">Mathias Stearn</assignee>
                                    <reporter username="shtylman">Roman Shtylman</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Apr 2010 17:01:08 +0000</created>
                <updated>Tue, 12 Jul 2016 00:29:33 +0000</updated>
                            <resolved>Fri, 23 Apr 2010 20:39:59 +0000</resolved>
                                                    <fixVersion>1.5.1</fixVersion>
                                    <component>Internal Client</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="13794" author="shtylman" created="Sat, 24 Apr 2010 14:22:02 +0000"  >&lt;p&gt;playing around with the code a bit, I removed the two new headers and just wrapped the various macros in ifdef blocks which are activated by the scons build when building mongo&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/shtylman/mongo&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/shtylman/mongo&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="13793" author="redbeard0531" created="Fri, 23 Apr 2010 20:39:59 +0000"  >&lt;p&gt;Example code now compiles if you add an argument to malloc() call. No extra headers are needed&lt;/p&gt;</comment>
                            <comment id="13791" author="auto" created="Fri, 23 Apr 2010 20:18:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;RedBeard0531&apos;, &apos;name&apos;: &apos;Mathias Stearn&apos;, &apos;email&apos;: &apos;mathias@10gen.com&apos;}
&lt;p&gt;Message: replace pragmas push_macro and pop_macro &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1042&quot; title=&quot;mongo c++ headers have a #define for malloc, this breaks code compilation with certain boost headers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1042&quot;&gt;&lt;del&gt;SERVER-1042&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/0638bbfee235b70df345bf251b36228ec0416763&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/0638bbfee235b70df345bf251b36228ec0416763&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="13790" author="auto" created="Fri, 23 Apr 2010 18:12:14 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;RedBeard0531&apos;, &apos;name&apos;: &apos;Mathias Stearn&apos;, &apos;email&apos;: &apos;mathias@10gen.com&apos;}
&lt;p&gt;Message: Automatic cleanup of global macros in client headers. &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1042&quot; title=&quot;mongo c++ headers have a #define for malloc, this breaks code compilation with certain boost headers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1042&quot;&gt;&lt;del&gt;SERVER-1042&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/2f197d519217eee23d04ecff2d0050cda842e89b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/2f197d519217eee23d04ecff2d0050cda842e89b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="13788" author="redbeard0531" created="Fri, 23 Apr 2010 15:37:06 +0000"  >&lt;p&gt;The issue is that these headers are also used internally in mongodb where we do want the macros to be defined. I&apos;ll see what I can do to alleviate the issue.&lt;/p&gt;</comment>
                            <comment id="13787" author="shtylman" created="Fri, 23 Apr 2010 15:24:06 +0000"  >&lt;p&gt;While this does fix the issue in the immediate case (just like doing an #undef would); this solution seems very brittle and viable to be overlooked by the user of the api. They should not have to include a random &quot;cleanup&quot; header who&apos;s sole purpose is to undo bad behavior in another header. I think a much cleaner solution would be to not have a public API overwrite system methods without the user explicitly requesting it. Calling one system method only to discover that it got replaced by a third party library method would not appeal to many users of the c++ api. &lt;/p&gt;</comment>
                            <comment id="13785" author="redbeard0531" created="Fri, 23 Apr 2010 14:29:40 +0000"  >&lt;p&gt;If you include mongo/client/cleanup.h as the last mongo header it will remove all of our macros. This file should cherry-pick cleanly to the 1.4 branch so let us know if you need a backport.&lt;/p&gt;</comment>
                            <comment id="13784" author="auto" created="Fri, 23 Apr 2010 14:26:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;RedBeard0531&apos;, &apos;name&apos;: &apos;Mathias Stearn&apos;, &apos;email&apos;: &apos;mathias@10gen.com&apos;}
&lt;p&gt;Message: cleanup.h to undef macros &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1042&quot; title=&quot;mongo c++ headers have a #define for malloc, this breaks code compilation with certain boost headers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1042&quot;&gt;&lt;del&gt;SERVER-1042&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/60002a474169de84eac6bce20836ee553abf731c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/60002a474169de84eac6bce20836ee553abf731c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="13783" author="auto" created="Fri, 23 Apr 2010 14:26:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;RedBeard0531&apos;, &apos;name&apos;: &apos;Mathias Stearn&apos;, &apos;email&apos;: &apos;mathias@10gen.com&apos;}
&lt;p&gt;Message: cleanup namespace pollution &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1042&quot; title=&quot;mongo c++ headers have a #define for malloc, this breaks code compilation with certain boost headers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1042&quot;&gt;&lt;del&gt;SERVER-1042&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/1d746cc4ca39790b89c8904c63ab42b41ed3d83b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/1d746cc4ca39790b89c8904c63ab42b41ed3d83b&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="33478">SERVER-5348</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 23 Apr 2010 14:26:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 years, 43 weeks, 4 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 years, 43 weeks, 4 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
            <customfieldvalue>shtylman</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrirav:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hriowv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>22688</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrip67:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>