<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic memory allocation  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation/m-p/1146593#M26744</link>
    <description>&lt;DIV&gt;I wrote a sample code to test mkl_malloc as below.&lt;/DIV&gt;

&lt;DIV&gt;When I run this code, I encounted memory error.&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;Could somebody explain to me why this happened and how to slove this problem??&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;
	&lt;PRE class="brush:cpp; class-name:dark;"&gt;typedef struct _a_
{
	int *data;
	_a_()
	{
		data = (int *)mkl_malloc(10 * sizeof(int), 32);
		for (int i = 0; i &amp;lt; 10; i++)
		{
			data&lt;I&gt; = i;
		}
	}
	
	~_a_()
	{
		mkl_free(data);
	}
}a_;

int main(void)
{
	a_ *b;
	b = (a_ *)mkl_malloc(10 * sizeof(a_), 32);

	std::cout &amp;lt;&amp;lt; b[0].data[0] &amp;lt;&amp;lt; std::endl;


	mkl_free(b);
	return 0;
}&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 22 Oct 2018 08:43:22 GMT</pubDate>
    <dc:creator>yoo__jungmin</dc:creator>
    <dc:date>2018-10-22T08:43:22Z</dc:date>
    <item>
      <title>memory allocation</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation/m-p/1146593#M26744</link>
      <description>&lt;DIV&gt;I wrote a sample code to test mkl_malloc as below.&lt;/DIV&gt;

&lt;DIV&gt;When I run this code, I encounted memory error.&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;Could somebody explain to me why this happened and how to slove this problem??&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;
	&lt;PRE class="brush:cpp; class-name:dark;"&gt;typedef struct _a_
{
	int *data;
	_a_()
	{
		data = (int *)mkl_malloc(10 * sizeof(int), 32);
		for (int i = 0; i &amp;lt; 10; i++)
		{
			data&lt;I&gt; = i;
		}
	}
	
	~_a_()
	{
		mkl_free(data);
	}
}a_;

int main(void)
{
	a_ *b;
	b = (a_ *)mkl_malloc(10 * sizeof(a_), 32);

	std::cout &amp;lt;&amp;lt; b[0].data[0] &amp;lt;&amp;lt; std::endl;


	mkl_free(b);
	return 0;
}&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Oct 2018 08:43:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation/m-p/1146593#M26744</guid>
      <dc:creator>yoo__jungmin</dc:creator>
      <dc:date>2018-10-22T08:43:22Z</dc:date>
    </item>
    <item>
      <title>Jungmin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation/m-p/1146594#M26745</link>
      <description>&lt;P&gt;Jungmin,&lt;/P&gt;

&lt;P&gt;I can't say for sure because I need to know what the error was and which line it refers to. You may be getting the error because you declared data as a pointer but are attempting to traverse it as if it were an array. If you tell me what the error is I can be more certain.&lt;/P&gt;

&lt;P&gt;Pamela&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 20:08:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation/m-p/1146594#M26745</guid>
      <dc:creator>Pamela_H_Intel</dc:creator>
      <dc:date>2018-10-25T20:08:04Z</dc:date>
    </item>
  </channel>
</rss>

