[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] LPC2468 with lwIP 1.4.x corrupting memory
From: |
Mikael Eiman |
Subject: |
Re: [lwip-users] LPC2468 with lwIP 1.4.x corrupting memory |
Date: |
Mon, 12 Nov 2012 21:13:16 +0100 |
Hi again,
I'm going to reply to myself and say that I might finally have found the source
of my problem: in the callback I set with tcp_err() I was calling tcp_close()
on the connection. I removed that tcp_close() call, and things seem to be
working better and I'm not leaking memory. So likely I was causing a double
free(), which is a good way to corrupt memory.
regards,
Mikael
12 nov 2012 kl. 18:51 skrev Mikael Eiman <address@hidden>:
> Hi,
>
> I'm having trouble in a project where I'm using lwIP 1.4.x (tried 1.4.1 and
> 1.4.0). I get my memory corrupted, and I can't figure out what I'm doing
> wrong.
>
> The problem is easiest to reproduce when I'm unable to connect to the server,
> after just a few tries I get stuck in a failed assert somewhere deep in lwIP,
> or in a DAbt handler after malloc() runs off a cliff. Since this happens
> without any data flowing around, the possible places where things can go
> wrong should be limited.
>
> I'm using FreeRTOS, but all the code that calls lwIP functions is contained
> in a single task, which is why I'm using NO_SYS.
>
> If I switch to the non-malloc() variants of memory handling the code runs
> better, but still crashes sooner or later - the corruption is probably still
> happening but contained to the lwIP static buffers it's less likely to cause
> general mayhem.
>
> Has anyone had a similar problem, or any suggestions for what kind of errors
> I should be looking for in my code?
>
> regards,
> Mikael
>
>
> My lwIP configuration:
>
> #define NO_SYS 1
> #define SYS_LIGHTWEIGHT_PROT 1
> typedef int sys_prot_t;
>
> #define MEM_LIBC_MALLOC 1 // Don't make this 1, or malloc() will
> be all fucked up
> #define MEMP_MEM_MALLOC 1 // Don't make this 1, or malloc() will
> be all fucked up
> #define MEM_ALIGNMENT 4
> #define MEM_SIZE (8 * 1024)
> #define MEMP_NUM_PBUF 64
> #define MEMP_NUM_UDP_PCB 4
> #define MEMP_NUM_TCP_PCB 4
> #define MEMP_NUM_TCP_PCB_LISTEN 2
> #define MEMP_NUM_TCP_SEG 32
> #define MEMP_NUM_REASSDATA 8
> #define MEMP_NUM_ARP_QUEUE 10
> #define MEMP_NUM_SYS_TIMEOUT 5
> #define PBUF_POOL_SIZE 32
>
> #define LWIP_ARP 1
> #define IP_REASS_MAX_PBUFS 8
> #define IP_FRAG_USES_STATIC_BUF 0
> #define IP_DEFAULT_TTL 255
> #define IP_SOF_BROADCAST 1
> #define IP_SOF_BROADCAST_RECV 1
> #define LWIP_ICMP 1
> #define LWIP_BROADCAST_PING 0
> #define LWIP_MULTICAST_PING 0
> #define LWIP_RAW 1
> #define LWIP_AUTOIP 0
> #define TCP_MSS 1460
> #define TCP_WND (4 * TCP_MSS)
> #define TCP_SND_BUF (6 * TCP_MSS)
> //#define TCP_SND_QUEUELEN 128 //(4 * (TCP_SND_BUF/TCP_MSS))
> #define TCP_LISTEN_BACKLOG 0
> #define LWIP_NETIF_STATUS_CALLBACK 1
> #define LWIP_NETIF_LINK_CALLBACK 1
> #define LWIP_NETIF_HWADDRHINT 1
> #define LWIP_NETCONN 0
> #define LWIP_SOCKET 0
> #define ETHARP_TRUST_IP_MAC 0
> //#define ETH_PAD_SIZE 2
> #define LWIP_CHKSUM_ALGORITHM 2
>
> #define LWIP_TCP_KEEPALIVE 1
>
> // Keepalive values, compliant with RFC 1122. Don't change this unless you
> know what you're doing
> #define TCP_KEEPIDLE_DEFAULT 10000UL // Default KEEPALIVE timer in
> milliseconds
> #define TCP_KEEPINTVL_DEFAULT 2000UL // Default Time between KEEPALIVE
> probes in milliseconds
> #define TCP_KEEPCNT_DEFAULT 9U // Default Counter for KEEPALIVE
> probes
>
> #define LWIP_STATS 1
> #define LWIP_STATS_DISPLAY 1
> #define MEM_STATS 1
> #define SYS_STATS 1
> #define MEMP_STATS 1
> #define LINK_STATS 1
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users