From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3771 invoked by alias); 4 Nov 2008 19:29:05 -0000 Received: (qmail 3731 invoked by uid 22791); 4 Nov 2008 19:29:03 -0000 X-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_53,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-gx0-f10.google.com (HELO mail-gx0-f10.google.com) (209.85.217.10) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Nov 2008 19:28:26 +0000 Received: by gxk3 with SMTP id 3so32608gxk.21 for ; Tue, 04 Nov 2008 11:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=Q5FOm4RmzT+txmTc2cvKOr2HpCHlyprXTP8ypW9zj44=; b=AX8sbkp8urdVJqOGl2b9kkc3f4Jq9KRfpapKKg44dEYhLdARTGevzNYacqRsGbO9Pj qXu3xXdcjV7H87pGrerCfyo3fKCq4Hl62Iuyx7x7DI/N8itLO2E/H/aU4lRUAMXbNIEi M10fxM3cFxTwWPKtLOn/teV58PwohxDYET3f4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=bXg2obb6thxLyiteiT1SXoxS+yJUsPZkwo8jH69I5mQcCU5wfL8rGyQi1sDc52O9nL ODiOrNIvesT3DzSocWqIuZBcusPUUlHRHlirWXl2OUQMZrjweRroERN6mqJmLruZNbvg 6uDkrNiHN3mGQVvEPHsM0QLhMe0muudUyy0OI= Received: by 10.150.206.11 with SMTP id d11mr80599ybg.181.1225826903931; Tue, 04 Nov 2008 11:28:23 -0800 (PST) Received: by 10.151.44.8 with HTTP; Tue, 4 Nov 2008 11:28:23 -0800 (PST) Message-ID: <69b5c5160811041128q74c4a47dwb4d416288a0255b4@mail.gmail.com> Date: Tue, 04 Nov 2008 19:29:00 -0000 From: "andrew wiggin" To: ecos-devel@ecos.sourceware.org Subject: REGION TOP and malloc MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2008-11/txt/msg00002.txt.bz2 Hi all, I am currently working on an AT91-like board for which I have 16MB of SDRAM. However, not all of the SDRAM can be used, so I added the support for CYGINT_HAL_ARM_MEM_REAL_REGION_TOP and it seems to work well in the sense that my hal_arm_mem_real_region_top() function is called, and the _actual_ TOP is returned. Though, my problem is that malloc() still continues to return addresses above my actual heap TOP. I tried to read the code, my heaps.cxx really seems OK: Cyg_Mempool_dlmalloc CYGBLD_ATTRIB_INIT_BEFORE(CYG_INIT_MEMALLOC) cygmem_pool_heap1 ( (cyg_uint8 *)CYGMEM_SECTION_heap1 , HAL_MEM_REAL_REGION_TOP( (cyg_uint8 *)CYGMEM_SECTION_heap1 + CYGMEM_SECTION_heap1_SIZE ) - (cyg_uint8 *)CYGMEM_SECTION_heap1 ) ; Which really makes the base address and size I have, and according to the different Malloc implementation (mvarimpl.inl and dlmalloc.cxx), malloc should either fail or return a valid address (which _is_ possible as I allocate only 800kB out of 8.9MB available). In order to do the test, I just replaced all my calls to malloc() with: void* ptr = malloc(size); \ CYG_ASSERT(ptr <= HAL_MEM_REAL_REGION_TOP( (cyg_uint8 *)CYGMEM_SECTION_heap1 + CYGMEM_SECTION_heap1_SIZE ), "malloc returned an @ out of memory..." ) This assert always fail after a while (but as stated above, mallinfo() returns 8.9MB free at this point and the size asked for is lower than 800kB). So where did I miss something ? Thanks in advance, -- damien